Merge pull request 'BUG修复、岗位关联关系调整' (#89) from feature/dxf into develop
Reviewed-on: http://221.226.25.34:3000/liang.cheng/weaver-hrm-organization/pulls/89
This commit is contained in:
commit
6d2b452354
|
|
@ -10,6 +10,7 @@ import com.engine.organization.mapper.department.DepartmentMapper;
|
|||
import com.engine.organization.mapper.employee.EmployeeMapper;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.util.*;
|
||||
|
|
@ -38,7 +39,7 @@ public class DepartmentBO {
|
|||
.subCompanyName(0 == e.getSubCompanyId1() ? "" : MapperProxyFactory.getProxy(CompMapper.class).listById(e.getSubCompanyId1()).getSubCompanyName())
|
||||
.supDepId(e.getSupDepId())
|
||||
.supDepName(null == poMaps.get(e.getSupDepId()) ? "" : poMaps.get(e.getSupDepId()).getDepartmentName())
|
||||
.deptPrincipal(getEmployeeNameById(e.getId()))
|
||||
.bmfzr(getEmployeeNameById(e.getId()))
|
||||
.showOrder(null == e.getShowOrder() ? 0 : e.getShowOrder())
|
||||
.canceled(null == e.getCanceled() ? 0 : e.getCanceled())
|
||||
.build()).collect(Collectors.toList());
|
||||
|
|
@ -154,11 +155,14 @@ public class DepartmentBO {
|
|||
}
|
||||
|
||||
public static String getEmployeeNameById(Integer id) {
|
||||
Long departmentPrincipal = MapperProxyFactory.getProxy(DepartmentMapper.class).getDepartmentPrincipal(id);
|
||||
if (null == departmentPrincipal) {
|
||||
if (null == id) {
|
||||
return "";
|
||||
}
|
||||
return MapperProxyFactory.getProxy(EmployeeMapper.class).getEmployeeNameById(departmentPrincipal);
|
||||
String departmentPrincipal = MapperProxyFactory.getProxy(DepartmentMapper.class).getDepartmentPrincipal(id);
|
||||
if (StringUtils.isBlank(departmentPrincipal)) {
|
||||
return "";
|
||||
}
|
||||
return MapperProxyFactory.getProxy(EmployeeMapper.class).getEmployeeNameById(Long.parseLong(departmentPrincipal));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -66,8 +66,8 @@ public class DepartmentListDTO {
|
|||
/**
|
||||
* 部门负责人
|
||||
*/
|
||||
@TableTitle(title = "部门负责人", dataIndex = "deptPrincipal", key = "deptPrincipal")
|
||||
private String deptPrincipal;
|
||||
@TableTitle(title = "部门负责人", dataIndex = "bmfzr", key = "bmfzr")
|
||||
private String bmfzr;
|
||||
|
||||
/**
|
||||
* 显示顺序
|
||||
|
|
|
|||
|
|
@ -21,11 +21,11 @@ import lombok.NoArgsConstructor;
|
|||
@AllArgsConstructor
|
||||
@OrganizationTable(pageId = "80e7830c-18e8-4e14-8241-18821195ef31",
|
||||
fields = "t.id," +
|
||||
"t.last_name," +
|
||||
"t.lastname," +
|
||||
"t.mobile," +
|
||||
"t.company_start_date," +
|
||||
"t.companystartdate," +
|
||||
"t.sex",
|
||||
fromSql = "FROM jcl_org_hrmresource t ",
|
||||
fromSql = "FROM hrmresource t ",
|
||||
orderby = "id",
|
||||
primarykey = "id",
|
||||
tableType = WeaTableType.NONE
|
||||
|
|
@ -35,7 +35,7 @@ public class EmployeeTableVO {
|
|||
@OrganizationTableColumn(column = "id", display = false)
|
||||
private Long id;
|
||||
|
||||
@OrganizationTableColumn(text = "姓名", width = "25%", column = "last_name")
|
||||
@OrganizationTableColumn(text = "姓名", width = "25%", column = "lastname")
|
||||
private String lastname;
|
||||
|
||||
@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")
|
||||
private String mobile;
|
||||
|
||||
@OrganizationTableColumn(text = "入职日期", width = "25%", column = "company_start_date")
|
||||
@OrganizationTableColumn(text = "入职日期", width = "25%", column = "companystartdate")
|
||||
private String companystartdate;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,8 @@ import lombok.NoArgsConstructor;
|
|||
sortway = " asc",
|
||||
primarykey = "id",
|
||||
operates = {
|
||||
@OrganizationTableOperate(text = "查看")
|
||||
@OrganizationTableOperate(text = "查看"),
|
||||
@OrganizationTableOperate(index = "1", text = "另存为版本")
|
||||
},
|
||||
tableType = WeaTableType.CHECKBOX
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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.vo.SingleJobTreeVO;
|
||||
import com.engine.organization.entity.searchtree.SearchTree;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
import com.engine.organization.transmethod.JobTransMethod;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -30,11 +28,10 @@ public class JobBO {
|
|||
.builder()
|
||||
.id(param.getId() == null ? 0 : param.getId())
|
||||
.jobNo(param.getJobNo())
|
||||
.jobName(param.getJobName())
|
||||
.jobTitleName(param.getJobTitleName())
|
||||
.ecJobTitle(param.getEcJobTitle())
|
||||
.ecCompany(param.getEcCompany())
|
||||
.ecDepartment(param.getEcDepartment())
|
||||
.parentComp(param.getSubcompanyid1())
|
||||
.parentDept(param.getDepartmentid())
|
||||
.sequenceId(param.getSequenceId())
|
||||
.schemeId(param.getSchemeId())
|
||||
.parentJob(param.getParentJob())
|
||||
|
|
@ -64,10 +61,10 @@ public class JobBO {
|
|||
.builder()
|
||||
.id(e.getId())
|
||||
.jobNo(e.getJobNo())
|
||||
.jobName(e.getJobName())
|
||||
.parentJobName(null == poMaps.get(e.getParentJob()) ? "" : poMaps.get(e.getParentJob()).getJobName())
|
||||
.jobName(e.getJobTitleName())
|
||||
.parentJobName(null == poMaps.get(e.getParentJob()) ? "" : poMaps.get(e.getParentJob()).getJobTitleName())
|
||||
.parentJob(e.getParentJob())
|
||||
.parentDept(e.getParentDept())
|
||||
.parentDept(e.getEcDepartment())
|
||||
.build()).collect(Collectors.toList());
|
||||
//获取非一级部门
|
||||
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()
|
||||
.id(e.getId())
|
||||
.jobNo(e.getJobNo())
|
||||
.jobName(e.getJobName())
|
||||
.jobTitleName(e.getJobTitleName())
|
||||
.subCompanyName(e.getSubCompanyName())
|
||||
.departmentName(e.getDepartmentName())
|
||||
.sequenceName(e.getSequenceName())
|
||||
.schemeName(e.getSchemeName())
|
||||
//.sequenceName(e.getSequenceName())
|
||||
//.schemeName(e.getSchemeName())
|
||||
//.parentJob(e.getParentJob())
|
||||
//.parentJobName(null == poMaps.get(e.getParentJob()) ? "" : poMaps.get(e.getParentJob()).getJobName())
|
||||
.isKey(JobTransMethod.getIsKeySpan(e.getIsKey()))
|
||||
.showOrder(e.getShowOrder())
|
||||
.forbiddenTag(e.getForbiddenTag())
|
||||
//.forbiddenTag(e.getForbiddenTag())
|
||||
.isUsed(0)
|
||||
.build()).collect(Collectors.toList());
|
||||
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 -> {
|
||||
List<JobListDTO> childList = collects.get(e.getId());
|
||||
if (CollectionUtils.isNotEmpty(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());
|
||||
}
|
||||
|
|
@ -154,14 +143,18 @@ public class JobBO {
|
|||
tree.setId(item.getId().toString());
|
||||
tree.setIsParent(false);
|
||||
tree.setIsVirtual("0");
|
||||
tree.setName(item.getJobName());
|
||||
tree.setName(item.getJobTitleName());
|
||||
tree.setPid(null == item.getParentJob() ? "0" : item.getParentJob().toString());
|
||||
tree.setSelected(false);
|
||||
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());
|
||||
return tree;
|
||||
}).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")
|
||||
private String jobName;
|
||||
@TableTitle(title = "名称", dataIndex = "jobTitleName", key = "jobTitleName", width = "150")
|
||||
private String jobTitleName;
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
|
|
@ -54,13 +54,13 @@ public class JobListDTO {
|
|||
/**
|
||||
* 岗位序列
|
||||
*/
|
||||
@TableTitle(title = "岗位序列", dataIndex = "sequenceName", key = "sequenceName")
|
||||
private String sequenceName;
|
||||
//@TableTitle(title = "岗位序列", dataIndex = "sequenceName", key = "sequenceName")
|
||||
//private String sequenceName;
|
||||
/**
|
||||
* 等级方案
|
||||
*/
|
||||
@TableTitle(title = "等级方案", dataIndex = "schemeName", key = "schemeName")
|
||||
private String schemeName;
|
||||
//@TableTitle(title = "等级方案", dataIndex = "schemeName", key = "schemeName")
|
||||
//private String schemeName;
|
||||
/**
|
||||
* 上级岗位
|
||||
*/
|
||||
|
|
@ -84,8 +84,8 @@ public class JobListDTO {
|
|||
/**
|
||||
* 禁用标记
|
||||
*/
|
||||
@TableTitle(title = "是否启用", dataIndex = "forbiddenTag", key = "forbiddenTag")
|
||||
private Integer forbiddenTag;
|
||||
//@TableTitle(title = "是否启用", dataIndex = "forbiddenTag", key = "forbiddenTag")
|
||||
//private Integer forbiddenTag;
|
||||
|
||||
/**
|
||||
* 操作列
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class JobSearchParam extends BaseQueryParam {
|
|||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String jobName;
|
||||
private String jobTitleName;
|
||||
/**
|
||||
* ec分部
|
||||
*/
|
||||
|
|
@ -82,4 +82,6 @@ public class JobSearchParam extends BaseQueryParam {
|
|||
private Integer subcompanyid1;
|
||||
|
||||
private Integer departmentid;
|
||||
|
||||
private Integer ecJobTitle;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,20 +29,20 @@ public class JobPO {
|
|||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String jobName;
|
||||
/**
|
||||
* 所属分部
|
||||
*/
|
||||
private Integer parentComp;
|
||||
private String jobTitleName;
|
||||
///**
|
||||
// * 所属分部
|
||||
// */
|
||||
//private Integer parentComp;
|
||||
|
||||
/**
|
||||
* ec分部
|
||||
*/
|
||||
private Integer ecCompany;
|
||||
/**
|
||||
* 所属部门
|
||||
*/
|
||||
private Integer parentDept;
|
||||
///**
|
||||
// * 所属部门
|
||||
// */
|
||||
//private Integer parentDept;
|
||||
/**
|
||||
* ec部门
|
||||
*/
|
||||
|
|
@ -93,6 +93,8 @@ public class JobPO {
|
|||
|
||||
private String levelId;
|
||||
|
||||
private Integer ecJobTitle;
|
||||
|
||||
|
||||
private Long creator;
|
||||
private int deleteType;
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@
|
|||
<if test=" CompanyPO.supSubComId != null ">
|
||||
and t.supSubComId = #{CompanyPO.supSubComId}
|
||||
</if>
|
||||
<include refid="isCanceled"/>
|
||||
order by ${orderSql}
|
||||
</select>
|
||||
|
||||
|
|
@ -213,4 +214,17 @@
|
|||
and isnull(canceled,0)=0
|
||||
</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>
|
||||
|
|
@ -96,6 +96,6 @@ public interface DepartmentMapper {
|
|||
|
||||
String getIdByDepartmentCode(@Param("departmentCode") String departmentCode);
|
||||
|
||||
Long getDepartmentPrincipal(@Param("deptId") Integer deptId);
|
||||
String getDepartmentPrincipal(@Param("deptId") Integer deptId);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@
|
|||
<if test=" departmentPO.departmentId != null ">
|
||||
and t.id = #{departmentPO.departmentId}
|
||||
</if>
|
||||
<include refid="isCanceled"/>
|
||||
order by ${orderSql}
|
||||
</select>
|
||||
|
||||
|
|
@ -147,7 +148,7 @@
|
|||
from hrmdepartment
|
||||
where departmentcode = #{departmentCode}
|
||||
</select>
|
||||
<select id="getDepartmentPrincipal" resultType="java.lang.Long">
|
||||
<select id="getDepartmentPrincipal" resultType="java.lang.String">
|
||||
select bmfzr
|
||||
from hrmdepartmentdefined
|
||||
where deptid = #{deptId}
|
||||
|
|
@ -180,4 +181,17 @@
|
|||
</if>
|
||||
</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>
|
||||
|
|
@ -79,24 +79,6 @@ public interface JobMapper {
|
|||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* 查询所有被引用的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 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">
|
||||
<result column="id" property="id"/>
|
||||
<result column="job_no" property="jobNo"/>
|
||||
<result column="job_name" property="jobName"/>
|
||||
<result column="parent_comp" property="parentComp"/>
|
||||
<result column="parent_dept" property="parentDept"/>
|
||||
<result column="jobtitlename" property="jobTitleName"/>
|
||||
<result column="ecJobTitle" property="ecJobTitle"/>
|
||||
<result column="ec_company" property="ecCompany"/>
|
||||
<result column="ec_department" property="ecDepartment"/>
|
||||
<result column="sequence_id" property="sequenceId"/>
|
||||
|
|
@ -34,9 +33,8 @@
|
|||
id
|
||||
,
|
||||
t.job_no,
|
||||
t.job_name,
|
||||
t.parent_comp,
|
||||
t.parent_dept,
|
||||
h.jobtitlename,
|
||||
t.ec_jobTitle,
|
||||
t.ec_company,
|
||||
t.ec_department,
|
||||
t.sequence_id,
|
||||
|
|
@ -73,15 +71,6 @@
|
|||
<if test="jobNo != null ">
|
||||
job_no,
|
||||
</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 ">
|
||||
sequence_id,
|
||||
</if>
|
||||
|
|
@ -133,16 +122,6 @@
|
|||
<if test="jobNo != null ">
|
||||
#{jobNo},
|
||||
</if>
|
||||
<if test="jobName != null ">
|
||||
#{jobName},
|
||||
</if>
|
||||
|
||||
<if test="parentComp != null ">
|
||||
#{parentComp},
|
||||
</if>
|
||||
<if test="parentDept != null ">
|
||||
#{parentDept},
|
||||
</if>
|
||||
<if test="sequenceId != null ">
|
||||
#{sequenceId},
|
||||
</if>
|
||||
|
|
@ -202,15 +181,6 @@
|
|||
<if test="jobNo != null ">
|
||||
job_no,
|
||||
</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 ">
|
||||
sequence_id,
|
||||
</if>
|
||||
|
|
@ -262,16 +232,6 @@
|
|||
<if test="jobNo != null ">
|
||||
#{jobNo},
|
||||
</if>
|
||||
<if test="jobName != null ">
|
||||
#{jobName},
|
||||
</if>
|
||||
|
||||
<if test="parentComp != null ">
|
||||
#{parentComp},
|
||||
</if>
|
||||
<if test="parentDept != null ">
|
||||
#{parentDept},
|
||||
</if>
|
||||
<if test="sequenceId != null ">
|
||||
#{sequenceId},
|
||||
</if>
|
||||
|
|
@ -314,9 +274,6 @@
|
|||
<set>
|
||||
creator=#{creator},
|
||||
update_time=#{updateTime},
|
||||
job_name=#{jobName},
|
||||
parent_comp=#{parentComp},
|
||||
parent_dept=#{parentDept},
|
||||
ec_company=#{ecCompany},
|
||||
ec_department=#{ecDepartment},
|
||||
sequence_id=#{sequenceId},
|
||||
|
|
@ -351,18 +308,7 @@
|
|||
#{id}
|
||||
</foreach>
|
||||
</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"
|
||||
parameterType="com.engine.organization.entity.job.po.JobPO">
|
||||
|
|
@ -373,6 +319,8 @@
|
|||
d.scheme_name,
|
||||
<include refid="baseColumns"/>
|
||||
FROM jcl_org_job t
|
||||
left join hrmjobtitles h on
|
||||
t.ec_jobTitle = h.id
|
||||
left join hrmsubcompany a on
|
||||
t.ec_company = a.id
|
||||
left join hrmdepartment b on
|
||||
|
|
@ -383,12 +331,6 @@
|
|||
t.scheme_id = d.id
|
||||
WHERE t.delete_type = 0
|
||||
<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 ">
|
||||
and t.parent_job = #{jobPO.parentJob}
|
||||
</if>
|
||||
|
|
@ -429,6 +371,7 @@
|
|||
t.sequence_id = c.id
|
||||
left join jcl_org_scheme d on
|
||||
t.scheme_id = d.id
|
||||
left join hrmjobtitles h on t.ec_jobTitle = h.id
|
||||
WHERE t.delete_type = 0 order by ${orderSql}
|
||||
</select>
|
||||
|
||||
|
|
@ -436,16 +379,18 @@
|
|||
select
|
||||
<include refid="baseColumns"/>
|
||||
from jcl_org_job t
|
||||
where delete_type = 0
|
||||
and id = #{id}
|
||||
left join hrmjobtitles h on t.ec_jobTitle = h.id
|
||||
where t.delete_type = 0
|
||||
and t.id = #{id}
|
||||
</select>
|
||||
<select id="listJobsByIds" resultType="java.util.Map">
|
||||
select
|
||||
id as "id",
|
||||
job_name as "name"
|
||||
t.id as "id",
|
||||
h.jobtitlename as "name"
|
||||
from jcl_org_job t
|
||||
WHERE delete_type = 0
|
||||
AND id IN
|
||||
left join hrmjobtitles h on t.ec_jobTitle = h.id
|
||||
WHERE t.delete_type = 0
|
||||
AND t.id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
|
|
@ -453,50 +398,41 @@
|
|||
<select id="listByNo" resultMap="BaseResultMap">
|
||||
select
|
||||
<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 id="getJobsByPid" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
from jcl_org_job t
|
||||
left join hrmjobtitles h on t.ec_jobTitle = h.id
|
||||
where delete_type = 0
|
||||
and parent_job = #{pid}
|
||||
</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 < 4
|
||||
</select>
|
||||
<select id="listJobsByDepartmentId" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
from jcl_org_job t
|
||||
left join hrmjobtitles h on t.ec_jobTitle = h.id
|
||||
where delete_type = 0
|
||||
and parent_dept = #{departmentId}
|
||||
and ec_department = #{departmentId}
|
||||
</select>
|
||||
<select id="listAll" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
from jcl_org_job t
|
||||
left join hrmjobtitles h on t.ec_jobTitle = h.id
|
||||
where delete_type = 0
|
||||
</select>
|
||||
<select id="listPOsByFilter" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
FROM jcl_org_job t
|
||||
left join hrmjobtitles h on t.ec_jobTitle = h.id
|
||||
WHERE t.delete_type = 0
|
||||
<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 ">
|
||||
and t.sequence_id = #{jobPO.sequenceId}
|
||||
</if>
|
||||
|
|
@ -515,94 +451,42 @@
|
|||
from jcl_org_job
|
||||
</select>
|
||||
<select id="getIdByNameAndPid" resultType="java.lang.Long">
|
||||
select id
|
||||
from jcl_org_job
|
||||
where delete_type = 0 and job_name = #{jobName}
|
||||
and parent_comp = #{parentCompany}
|
||||
select
|
||||
t.id
|
||||
from
|
||||
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="nullparentJob"/>
|
||||
</select>
|
||||
<select id="getJobsByIds" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
from jcl_org_job t
|
||||
left join hrmjobtitles h on t.ec_jobTitle = h.id
|
||||
where delete_type = 0
|
||||
AND id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</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 < 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">
|
||||
and ifnull(parent_dept,0) =
|
||||
and ifnull(ec_department,0) =
|
||||
#{parentDepartment}
|
||||
</sql>
|
||||
|
||||
<sql id="nullparentDept" databaseId="sqlserver">
|
||||
and isnull(parent_dept,0) =
|
||||
and isnull(ec_department,0) =
|
||||
#{parentDepartment}
|
||||
</sql>
|
||||
|
||||
<sql id="nullparentDept" databaseId="oracle">
|
||||
and NVL(parent_dept,0) =
|
||||
and NVL(ec_department,0) =
|
||||
#{parentDepartment}
|
||||
</sql>
|
||||
|
||||
|
|
@ -611,8 +495,8 @@
|
|||
<if test=" jobPO.jobNo != null and jobPO.jobNo != '' ">
|
||||
and t.job_no like CONCAT('%',#{jobPO.jobNo},'%')
|
||||
</if>
|
||||
<if test=" jobPO.jobName != null and jobPO.jobName != '' ">
|
||||
and t.job_name like CONCAT('%',#{jobPO.jobName},'%')
|
||||
<if test=" jobPO.jobTitleName != null and jobPO.jobTitleName != '' ">
|
||||
and h.jobtitlename like CONCAT('%',#{jobPO.jobTitleName},'%')
|
||||
</if>
|
||||
<if test=" jobPO.workplace != null and jobPO.workplace != '' ">
|
||||
and t.workplace like CONCAT('%',#{jobPO.workplace},'%')
|
||||
|
|
@ -632,8 +516,8 @@
|
|||
<if test=" jobPO.jobNo != null and jobPO.jobNo != '' ">
|
||||
and t.job_no like '%'||#{jobPO.jobNo}||'%'
|
||||
</if>
|
||||
<if test=" jobPO.jobName != null and jobPO.jobName != '' ">
|
||||
and t.job_name like '%'||#{jobPO.jobName}||'%'
|
||||
<if test=" jobPO.jobTitleName != null and jobPO.jobTitleName != '' ">
|
||||
and h.jobtitlename like '%'||#{jobPO.jobTitleName}||'%'
|
||||
</if>
|
||||
<if test=" jobPO.workplace != null and jobPO.workplace != '' ">
|
||||
and t.workplace like '%'||#{jobPO.workplace}||'%'
|
||||
|
|
@ -653,8 +537,8 @@
|
|||
<if test=" jobPO.jobNo != null and jobPO.jobNo != '' ">
|
||||
and t.job_no like '%'+#{jobPO.jobNo}+'%'
|
||||
</if>
|
||||
<if test=" jobPO.jobName != null and jobPO.jobName != '' ">
|
||||
and t.job_name like '%'+#{jobPO.jobName}+'%'
|
||||
<if test=" jobPO.jobTitleName != null and jobPO.jobTitleName != '' ">
|
||||
and h.jobTitleName like '%'+#{jobPO.jobTitleName}+'%'
|
||||
</if>
|
||||
<if test=" jobPO.workplace != null and jobPO.workplace != '' ">
|
||||
and t.workplace like '%'+#{jobPO.workplace}+'%'
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ import com.engine.organization.mapper.comp.CompMapper;
|
|||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
import com.engine.organization.service.DepartmentService;
|
||||
import com.engine.organization.thread.JobTriggerRunnable;
|
||||
import com.engine.organization.thread.OrganizationSyncEc;
|
||||
import com.engine.organization.util.*;
|
||||
import com.engine.organization.util.coderule.CodeRuleUtil;
|
||||
|
|
@ -409,12 +408,9 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
List<SearchConditionItem> condition = new ArrayList<>();
|
||||
SearchConditionItem compBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, false, "复制到", "164", "company", "");
|
||||
compBrowserItem.setRules("required|string");
|
||||
SearchConditionItem isCheckItem = OrganizationFormItemUtil.selectItem(user, Lists.newArrayList(new SearchConditionOption("1", "")), 2, 5, 10, false, "复制岗位信息", "copyJob");
|
||||
isCheckItem.setDetailtype(2);
|
||||
SearchConditionItem copySubDeptItem = OrganizationFormItemUtil.selectItem(user, Lists.newArrayList(new SearchConditionOption("1", "")), 2, 5, 10, false, "复制子部门信息", "copySubDept");
|
||||
copySubDeptItem.setDetailtype(2);
|
||||
condition.add(compBrowserItem);
|
||||
condition.add(isCheckItem);
|
||||
condition.add(copySubDeptItem);
|
||||
addGroups.add(new SearchConditionGroup("", true, condition));
|
||||
return addGroups;
|
||||
|
|
@ -464,15 +460,15 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
//TODO new DepartmentTriggerRunnable(deptById.getId()).run();
|
||||
|
||||
// 复制当前部门岗位信息
|
||||
if ("1".equals(copyJob)) {
|
||||
List<JobPO> jobPOS = MapperProxyFactory.getProxy(JobMapper.class).listJobsByDepartmentId(originalDeptId);
|
||||
jobPOS = jobPOS.stream().filter(item -> null == item.getParentJob() || 0 == item.getParentJob()).collect(Collectors.toList());
|
||||
Integer maxJobOrder = MapperProxyFactory.getProxy(JobMapper.class).getMaxShowOrder();
|
||||
if (maxJobOrder == null) {
|
||||
maxJobOrder = 0;
|
||||
}
|
||||
recursionCopyJob(jobPOS, companyId, Integer.parseInt(ecDepartmentID), null, maxJobOrder, timeMillis);
|
||||
}
|
||||
//if ("1".equals(copyJob)) {
|
||||
// List<JobPO> jobPOS = MapperProxyFactory.getProxy(JobMapper.class).listJobsByDepartmentId(originalDeptId);
|
||||
// jobPOS = jobPOS.stream().filter(item -> null == item.getParentJob() || 0 == item.getParentJob()).collect(Collectors.toList());
|
||||
// Integer maxJobOrder = MapperProxyFactory.getProxy(JobMapper.class).getMaxShowOrder();
|
||||
// if (maxJobOrder == null) {
|
||||
// maxJobOrder = 0;
|
||||
// }
|
||||
// recursionCopyJob(jobPOS, companyId, Integer.parseInt(ecDepartmentID), null, maxJobOrder, timeMillis);
|
||||
//}
|
||||
|
||||
// 是否复制子部门信息
|
||||
if ("1".equals(copySubDept)) {
|
||||
|
|
@ -543,10 +539,10 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
String mergeEcDeptId = mergeParam.getId().toString();
|
||||
rs.executeUpdate("update jcl_org_job set parent_comp =?,ec_company =?,parent_dept =?,ec_department =? where ec_department =?", targetDepartment.getSubCompanyId1(), targetDepartment.getSubCompanyId1(), targetDepartment.getId(), targetEcDeptId, mergeParam.getId());
|
||||
// 更新岗位组织架构图
|
||||
for (JobPO jobPO : firstChildJobList) {
|
||||
// 刷新组织架构图
|
||||
new JobTriggerRunnable(jobPO.getId()).run();
|
||||
}
|
||||
//for (JobPO jobPO : firstChildJobList) {
|
||||
// // 刷新组织架构图
|
||||
// TODO new JobTriggerRunnable(jobPO.getId()).run();
|
||||
//}
|
||||
// 更新当前部门下的人员
|
||||
rs.executeUpdate("update hrmresource set SUBCOMPANYID1 =?,DEPARTMENTID =? where DEPARTMENTID =?", targetDepartment.getSubCompanyId1(), targetEcDeptId, mergeEcDeptId);
|
||||
//new RecordSet().executeUpdate("update jcl_org_hrmresource set company_id =? ,ec_company = ? ,department_id = ?, ec_department = ?where department_id =?", targetDepartment.getParentComp(), targetDepartment.getEcCompany(), targetDepartment.getId(), targetEcDeptId, mergeParam.getId());
|
||||
|
|
@ -769,48 +765,6 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
return generateCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归复制岗位信息
|
||||
*
|
||||
* @param jobPOS
|
||||
* @param parentCompId
|
||||
* @param parentDeptId
|
||||
* @param orderNum
|
||||
*/
|
||||
private void recursionCopyJob(List<JobPO> jobPOS, Integer parentCompId, Integer parentDeptId, Long currentParentJobId, int orderNum, long timeMillis) {
|
||||
for (JobPO jobPO : jobPOS) {
|
||||
orderNum++;
|
||||
|
||||
// 查询源岗位的下级岗位
|
||||
List<JobPO> jobsByPid = MapperProxyFactory.getProxy(JobMapper.class).getJobsByPid(jobPO.getId());
|
||||
|
||||
// 处理自动编号
|
||||
jobPO.setJobNo(CodeRuleUtil.generateCode(RuleCodeType.JOBTITLES, jobPO.getJobNo(), timeMillis));
|
||||
|
||||
// 所属部门赋值
|
||||
jobPO.setParentDept(parentDeptId);
|
||||
jobPO.setEcDepartment(parentDeptId);
|
||||
|
||||
// 所属分部赋值
|
||||
jobPO.setEcCompany(parentCompId);
|
||||
jobPO.setParentComp(parentCompId);
|
||||
|
||||
// 指定上级岗位
|
||||
jobPO.setParentJob(currentParentJobId);
|
||||
jobPO.setCreator((long) user.getUID());
|
||||
jobPO.setCreateTime(new Date());
|
||||
jobPO.setShowOrder(orderNum);
|
||||
MapperProxyFactory.getProxy(JobMapper.class).insertIgnoreNull(jobPO);
|
||||
// 更新组织架构图
|
||||
new JobTriggerRunnable(jobPO.getId()).run();
|
||||
// 处理子级元素
|
||||
|
||||
if (CollectionUtils.isNotEmpty(jobsByPid)) {
|
||||
recursionCopyJob(jobsByPid, parentCompId, parentDeptId, jobPO.getId(), orderNum, timeMillis);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新EC表部门
|
||||
*
|
||||
|
|
@ -862,15 +816,15 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
* @param parentComp
|
||||
*/
|
||||
private void refreshJobComp(Integer parentDepartment, Integer parentComp) {
|
||||
List<JobPO> jobPOS = getJobMapper().listJobsByDepartmentId(parentDepartment);
|
||||
jobPOS = jobPOS.stream().filter(item -> null == item.getParentJob() || 0 == item.getParentJob()).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(jobPOS)) {
|
||||
getJobMapper().updateJobCompany(jobPOS.stream().map(JobPO::getId).collect(Collectors.toList()), parentComp, parentComp);
|
||||
for (JobPO jobPO : jobPOS) {
|
||||
// 刷新组织架构图
|
||||
new JobTriggerRunnable(jobPO.getId()).run();
|
||||
}
|
||||
}
|
||||
//List<JobPO> jobPOS = getJobMapper().listJobsByDepartmentId(parentDepartment);
|
||||
//jobPOS = jobPOS.stream().filter(item -> null == item.getParentJob() || 0 == item.getParentJob()).collect(Collectors.toList());
|
||||
//if (CollectionUtils.isNotEmpty(jobPOS)) {
|
||||
// getJobMapper().updateJobCompany(jobPOS.stream().map(JobPO::getId).collect(Collectors.toList()), parentComp, parentComp);
|
||||
// for (JobPO jobPO : jobPOS) {
|
||||
// // 刷新组织架构图
|
||||
// new JobTriggerRunnable(jobPO.getId()).run();
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
private List<SearchConditionGroup> getDepartmentConditionGroups(Map<String, Object> params) {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import com.api.browser.bean.SearchConditionItem;
|
|||
import com.engine.core.impl.Service;
|
||||
import com.engine.organization.entity.TopTab;
|
||||
import com.engine.organization.service.GroupService;
|
||||
import com.engine.organization.thread.GroupTriggerRunnable;
|
||||
import com.engine.organization.util.HasRightUtil;
|
||||
import com.engine.organization.util.MenuBtn;
|
||||
import com.engine.organization.util.OrganizationAssert;
|
||||
|
|
@ -83,7 +82,7 @@ public class GroupServiceImpl extends Service implements GroupService {
|
|||
String companyweb = (String) params.get("companyweb");
|
||||
RecordSet rs = new RecordSet();
|
||||
boolean executeUpdate = rs.executeUpdate("update HrmCompany set COMPANYNAME = ?,COMPANYDESC=?,COMPANYWEB=? where id = ?", companyname, companydesc, companyweb, id);
|
||||
new GroupTriggerRunnable(params).run();
|
||||
//TODO new GroupTriggerRunnable(params).run();
|
||||
return executeUpdate;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,16 +38,9 @@ import com.engine.organization.mapper.extend.ExtendTitleMapper;
|
|||
import com.engine.organization.mapper.hrmresource.HrmRelationMapper;
|
||||
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
|
||||
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.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.HrmResourceService;
|
||||
import com.engine.organization.thread.HrmResourceTriggerRunnable;
|
||||
import com.engine.organization.thread.OrganizationSyncEc;
|
||||
import com.engine.organization.util.HasRightUtil;
|
||||
import com.engine.organization.util.MenuBtn;
|
||||
|
|
@ -68,7 +61,6 @@ import weaver.hrm.User;
|
|||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
|
|
@ -117,30 +109,6 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
|
||||
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() {
|
||||
return MapperProxyFactory.getProxy(HrmRelationMapper.class);
|
||||
}
|
||||
|
|
@ -229,7 +197,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
RecordInfo recordInfo = getSystemDataMapper().getHrmObjectByID(HRM_RESOURCE, ecResourceId);
|
||||
params.put("uuid", recordInfo.getUuid());
|
||||
Long resourceId = getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_HRM, params, "", null);
|
||||
new HrmResourceTriggerRunnable(resourceId).run();
|
||||
// TODO new HrmResourceTriggerRunnable(resourceId).run();
|
||||
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);
|
||||
|
||||
new HrmResourceTriggerRunnable(id).run();
|
||||
// TODO new HrmResourceTriggerRunnable(id).run();
|
||||
} else {
|
||||
// 更新主表拓展表
|
||||
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);
|
||||
Map<String, Object> apiDatas = new HashMap<>();
|
||||
|
||||
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
||||
SearchConditionItem schemeId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "等级方案", "161", "schemeId", "schemeBrowser");
|
||||
schemeId.setRules("required");
|
||||
SearchConditionItem gradeId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "职级", "161", "gradeId", "gradeBrowser");
|
||||
gradeId.setRules("required");
|
||||
SearchConditionItem levelId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "职等", "162", "levelId", "levelBrowser");
|
||||
levelId.setRules("required");
|
||||
SearchConditionItem sequenceId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "岗位序列", "161", "sequenceId", "sequenceBrowser");
|
||||
sequenceId.setRules("required");
|
||||
SearchConditionItem postId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "职务分类", "161", "postId", "postBrowser");
|
||||
postId.setRules("required");
|
||||
SearchConditionItem postInfoId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "职务信息", "161", "postInfoId", "postInfoBrowser");
|
||||
postInfoId.setRules("required");
|
||||
SearchConditionItem companyId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "分部", "164", "companyId", "");
|
||||
companyId.setRules("required");
|
||||
SearchConditionItem departmentId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "部门", "4", "departmentId", "");
|
||||
departmentId.setRules("required");
|
||||
SearchConditionItem jobId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "岗位", "161", "jobId", "jobBrowser");
|
||||
jobId.setRules("required");
|
||||
|
||||
|
||||
// 编辑状态下赋值操作
|
||||
HrmRelationPO relationPO = getHrmRelationMapper().getRelationById(Long.parseLong(id));
|
||||
if (null != relationPO) {
|
||||
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(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(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());
|
||||
|
||||
List<Map<String, Object>> companyMaps = new ArrayList<>();
|
||||
String scCompanyNameById = MapperProxyFactory.getProxy(SystemDataMapper.class).getScCompanyNameById(relationPO.getCompanyId().toString());
|
||||
Map<String, Object> companyMap = new HashMap<>();
|
||||
companyMap.put(relationPO.getCompanyId().toString(), scCompanyNameById);
|
||||
companyMaps.add(companyMap);
|
||||
setBrowserValue(companyId, relationPO.getCompanyId(), companyMaps, null, null);
|
||||
|
||||
List<Map<String, Object>> departmentMaps = new ArrayList<>();
|
||||
String departmentNameById = MapperProxyFactory.getProxy(SystemDataMapper.class).getScDepartmentNameById(relationPO.getDepartmentId().toString());
|
||||
Map<String, Object> departmentMap = new HashMap<>();
|
||||
departmentMap.put(relationPO.getDepartmentId().toString(), departmentNameById);
|
||||
departmentMaps.add(departmentMap);
|
||||
setBrowserValue(departmentId, relationPO.getDepartmentId(), departmentMaps, "subcompany1", relationPO.getCompanyId());
|
||||
|
||||
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(companyId, departmentId, jobId).collect(Collectors.toList())));
|
||||
HashMap<String, Object> buttonsMap = new HashMap<>();
|
||||
buttonsMap.put("hasEdit", true);
|
||||
buttonsMap.put("hasSave", true);
|
||||
apiDatas.put("buttons", buttonsMap);
|
||||
apiDatas.put("conditions", addGroups);
|
||||
//List<SearchConditionGroup> addGroups = new ArrayList<>();
|
||||
//SearchConditionItem schemeId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "等级方案", "161", "schemeId", "schemeBrowser");
|
||||
//schemeId.setRules("required");
|
||||
//SearchConditionItem gradeId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "职级", "161", "gradeId", "gradeBrowser");
|
||||
//gradeId.setRules("required");
|
||||
//SearchConditionItem levelId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "职等", "162", "levelId", "levelBrowser");
|
||||
//levelId.setRules("required");
|
||||
//SearchConditionItem sequenceId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "岗位序列", "161", "sequenceId", "sequenceBrowser");
|
||||
//sequenceId.setRules("required");
|
||||
//SearchConditionItem postId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "职务分类", "161", "postId", "postBrowser");
|
||||
//postId.setRules("required");
|
||||
//SearchConditionItem postInfoId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "职务信息", "161", "postInfoId", "postInfoBrowser");
|
||||
//postInfoId.setRules("required");
|
||||
//SearchConditionItem companyId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "分部", "164", "companyId", "");
|
||||
//companyId.setRules("required");
|
||||
//SearchConditionItem departmentId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "部门", "4", "departmentId", "");
|
||||
//departmentId.setRules("required");
|
||||
//SearchConditionItem jobId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "岗位", "161", "jobId", "jobBrowser");
|
||||
//jobId.setRules("required");
|
||||
//
|
||||
//
|
||||
//// 编辑状态下赋值操作
|
||||
//HrmRelationPO relationPO = getHrmRelationMapper().getRelationById(Long.parseLong(id));
|
||||
//if (null != relationPO) {
|
||||
// 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(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(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());
|
||||
//
|
||||
// List<Map<String, Object>> companyMaps = new ArrayList<>();
|
||||
// String scCompanyNameById = MapperProxyFactory.getProxy(SystemDataMapper.class).getScCompanyNameById(relationPO.getCompanyId().toString());
|
||||
// Map<String, Object> companyMap = new HashMap<>();
|
||||
// companyMap.put(relationPO.getCompanyId().toString(), scCompanyNameById);
|
||||
// companyMaps.add(companyMap);
|
||||
// setBrowserValue(companyId, relationPO.getCompanyId(), companyMaps, null, null);
|
||||
//
|
||||
// List<Map<String, Object>> departmentMaps = new ArrayList<>();
|
||||
// String departmentNameById = MapperProxyFactory.getProxy(SystemDataMapper.class).getScDepartmentNameById(relationPO.getDepartmentId().toString());
|
||||
// Map<String, Object> departmentMap = new HashMap<>();
|
||||
// departmentMap.put(relationPO.getDepartmentId().toString(), departmentNameById);
|
||||
// departmentMaps.add(departmentMap);
|
||||
// setBrowserValue(departmentId, relationPO.getDepartmentId(), departmentMaps, "subcompany1", relationPO.getCompanyId());
|
||||
//
|
||||
// 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(companyId, departmentId, jobId).collect(Collectors.toList())));
|
||||
//HashMap<String, Object> buttonsMap = new HashMap<>();
|
||||
//buttonsMap.put("hasEdit", true);
|
||||
//buttonsMap.put("hasSave", true);
|
||||
//apiDatas.put("buttons", buttonsMap);
|
||||
//apiDatas.put("conditions", addGroups);
|
||||
return apiDatas;
|
||||
}
|
||||
|
||||
|
|
@ -455,36 +423,6 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
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 lastName = params.getLastName();
|
||||
if (StringUtils.isNotBlank(lastName)) {
|
||||
sqlWhere += " AND t.last_name " + dbType.like(lastName);
|
||||
sqlWhere += " AND t.lastname " + dbType.like(lastName);
|
||||
}
|
||||
Long companyId = params.getCompanyId();
|
||||
if (null != companyId) {
|
||||
sqlWhere += " AND t.company_id = '" + companyId + "'";
|
||||
sqlWhere += " AND t.subcompanyid1 = '" + companyId + "'";
|
||||
}
|
||||
Long departmentId = params.getDepartmentId();
|
||||
if (null != departmentId) {
|
||||
sqlWhere += " AND t.department_id = '" + departmentId + "'";
|
||||
sqlWhere += " AND t.departmentid = '" + departmentId + "'";
|
||||
}
|
||||
Long ecCompany = params.getEcCompany();
|
||||
if (null != ecCompany) {
|
||||
sqlWhere += " AND t.ec_company = '" + ecCompany + "'";
|
||||
sqlWhere += " AND t.subcompanyid1 = '" + ecCompany + "'";
|
||||
}
|
||||
Long ecDepartment = params.getEcDepartment();
|
||||
if (null != ecDepartment) {
|
||||
sqlWhere += " AND t.ec_department = '" + ecDepartment + "'";
|
||||
sqlWhere += " AND t.departmentid = '" + ecDepartment + "'";
|
||||
}
|
||||
String telephone = params.getTelephone();
|
||||
if (StringUtils.isNotBlank(telephone)) {
|
||||
|
|
@ -524,14 +462,15 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
}
|
||||
Long jobTitle = params.getJobTitle();
|
||||
if (null != jobTitle) {
|
||||
sqlWhere += " AND t.job_title = '" + jobTitle + "'";
|
||||
// TODO BUG修复
|
||||
sqlWhere += " AND t.jobtitle = '" + jobTitle + "'";
|
||||
}
|
||||
|
||||
// 分权查询
|
||||
DetachUtil detachUtil = new DetachUtil(user.getUID());
|
||||
String parentCompanyIds = detachUtil.getJclRoleLevels();
|
||||
if (detachUtil.isDETACH()) {
|
||||
sqlWhere += " And t.company_id in(" + parentCompanyIds + ")";
|
||||
sqlWhere += " And t.subcompanyid1 in(" + parentCompanyIds + ")";
|
||||
}
|
||||
|
||||
return sqlWhere;
|
||||
|
|
@ -542,21 +481,21 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
// 通过分部、公司 组装数据
|
||||
if (StringUtil.isEmpty(id) || TYPE_COMP.equals(type)) {
|
||||
Integer parentCompId = StringUtil.isEmpty(id) ? null : Integer.parseInt(id);
|
||||
DepartmentPO departmentBuild = DepartmentPO.builder().departmentName(keyword).subCompanyId1(parentCompId).build();
|
||||
CompPO compBuild = CompPO.builder().subCompanyName(keyword).supSubComId(parentCompId).build();
|
||||
DepartmentPO departmentBuild = DepartmentPO.builder().departmentName(keyword).subCompanyId1(parentCompId).canceled(0).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);
|
||||
} else if (TYPE_DEPT.equals(type)) {
|
||||
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);
|
||||
|
||||
} 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<>();
|
||||
for (JobPO departmentPO : filterDeparts) {
|
||||
buildParentJobs(departmentPO, builderJobs);
|
||||
|
|
@ -589,7 +528,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
String parentDeptS = jobTrees.stream().map(SearchTree::getParentComp).collect(Collectors.joining(","));
|
||||
if (!StringUtil.isEmpty(parentDeptS)) {
|
||||
// 兼容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);
|
||||
List<DepartmentPO> departmentsByIds = new ArrayList<>();
|
||||
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"));
|
||||
if (StringUtils.isNotBlank(jobId)) {
|
||||
JobPO jobById = getJobMapper().getJobById(Long.parseLong(jobId));
|
||||
params.put("department_id", jobById.getParentDept());
|
||||
params.put("company_id", jobById.getParentComp());
|
||||
params.put("department_id", jobById.getEcDepartment());
|
||||
params.put("company_id", jobById.getEcCompany());
|
||||
params.put("ec_department", jobById.getEcDepartment());
|
||||
params.put("ec_company", jobById.getEcCompany());
|
||||
// 等级方案、岗位序列、职等、职级
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import com.cloudstore.eccom.result.WeaResultMsg;
|
|||
import com.engine.core.impl.Service;
|
||||
import com.engine.organization.component.OrganizationWeaTable;
|
||||
import com.engine.organization.entity.extend.ExtendInfoOperateType;
|
||||
import com.engine.organization.entity.extend.param.ExtendInfoParams;
|
||||
import com.engine.organization.entity.extend.po.ExtendInfoPO;
|
||||
import com.engine.organization.entity.fieldset.param.FieldTransferParam;
|
||||
import com.engine.organization.entity.jclimport.po.JclImportHistoryDetailPO;
|
||||
|
|
@ -16,25 +15,16 @@ import com.engine.organization.entity.jclimport.vo.JclImportHistoryDetailVO;
|
|||
import com.engine.organization.entity.scheme.po.GradePO;
|
||||
import com.engine.organization.entity.scheme.po.LevelPO;
|
||||
import com.engine.organization.entity.scheme.po.SchemePO;
|
||||
import com.engine.organization.enums.LogModuleNameEnum;
|
||||
import com.engine.organization.enums.OperateTypeEnum;
|
||||
import com.engine.organization.enums.OrgImportEnum;
|
||||
import com.engine.organization.exception.OrganizationRunTimeException;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.employee.EmployeeMapper;
|
||||
import com.engine.organization.mapper.extend.ExtMapper;
|
||||
import com.engine.organization.mapper.extend.ExtendInfoMapper;
|
||||
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
|
||||
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.scheme.GradeMapper;
|
||||
import com.engine.organization.mapper.scheme.LevelMapper;
|
||||
import com.engine.organization.mapper.scheme.SchemeMapper;
|
||||
import com.engine.organization.service.ImportCommonService;
|
||||
import com.engine.organization.thread.JobTriggerRunnable;
|
||||
import com.engine.organization.thread.OrganizationSyncEc;
|
||||
import com.engine.organization.util.HasRightUtil;
|
||||
import com.engine.organization.util.OrganizationAssert;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
|
|
@ -232,8 +222,6 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
returnMap.put("pId", DepartmentImport.saveImport(operateType, excelFile, user));
|
||||
break;
|
||||
case "jobtitle":
|
||||
returnMap.put("pId", jobImport(operateType, excelFile));
|
||||
break;
|
||||
case "resource":
|
||||
returnMap.put("pId", ResourceImport.saveImport(operateType, excelFile, user, request));
|
||||
break;
|
||||
|
|
@ -353,272 +341,6 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
return lsGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* 岗位导入
|
||||
*/
|
||||
private Long jobImport(String operateType, String excelFile) {
|
||||
Long importHistoryId = OrgImportUtil.saveImportLog("jobtitle", operateType, user);
|
||||
JclImportHistoryDetailPO historyDetailPO;
|
||||
|
||||
ImageFileManager manager = new ImageFileManager();
|
||||
manager.getImageFileInfoById(Util.getIntValue(excelFile));
|
||||
XSSFWorkbook workbook;
|
||||
try {
|
||||
workbook = new XSSFWorkbook(manager.getInputStream());
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
// 当前sheet
|
||||
XSSFSheet sheetAt = workbook.getSheetAt(0);
|
||||
int lastRow = sheetAt.getLastRowNum();
|
||||
List<ExtendInfoPO> extendInfoPOS = new ArrayList<>();
|
||||
OrganizationAssert.isTrue(lastRow > 0, "导入数据为空");
|
||||
short lastCellNum = sheetAt.getRow(0).getLastCellNum();
|
||||
|
||||
// 遍历每一行数据
|
||||
nextRow:
|
||||
for (int i = 0; i <= lastRow; i++) {
|
||||
historyDetailPO = new JclImportHistoryDetailPO();
|
||||
historyDetailPO.setPid(importHistoryId);
|
||||
XSSFRow row = sheetAt.getRow(i);
|
||||
if (null == row) {
|
||||
continue;
|
||||
}
|
||||
// 组装待处理数据
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
Integer parentCompanyId = null;
|
||||
Integer parentDepartmentId = null;
|
||||
Long parentJobId = null;
|
||||
String jobName = "";
|
||||
|
||||
historyDetailPO.setRowNums(String.valueOf(i + 1));
|
||||
for (int cellIndex = 0; cellIndex < lastCellNum; cellIndex++) {
|
||||
XSSFCell cell = row.getCell((short) cellIndex);
|
||||
String cellValue = getCellValue(cell).trim();
|
||||
if (i == 0) {
|
||||
// 首行 初始化字段信息
|
||||
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().getInfoByExtendAndLabelName(JOB_TYPE, cellValue);
|
||||
boolean isBreak = OrgImportUtil.isBreak(historyDetailPO, cellValue, infoPOList);
|
||||
if (isBreak) {
|
||||
break nextRow;
|
||||
}
|
||||
ExtendInfoPO extendInfoPO = infoPOList.get(0);
|
||||
extendInfoPOS.add(extendInfoPO);
|
||||
} else {
|
||||
ExtendInfoPO infoPO = extendInfoPOS.get(cellIndex);
|
||||
// 数据校验
|
||||
if (infoPO.getIsrequired() == 1 && StringUtils.isBlank(cellValue) && !"job_no".equalsIgnoreCase(infoPO.getFieldName())) {
|
||||
historyDetailPO.setOperateDetail(infoPO.getFieldNameDesc() + "为必填项");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
|
||||
Object reallyValue;
|
||||
try {
|
||||
reallyValue = OrgImportUtil.getReallyValue(infoPO, cellValue);
|
||||
} catch (Exception e) {
|
||||
historyDetailPO.setOperateDetail(cellValue + "转换失败");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
if (StringUtils.isNotBlank(cellValue) && StringUtils.isBlank(Util.null2String(reallyValue)) && !"ec_company".equals(infoPO.getFieldName()) && !"ec_department".equals(infoPO.getFieldName())) {
|
||||
historyDetailPO.setOperateDetail(infoPO.getFieldNameDesc() + "数据转换失败,未找到对应数据");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
map.put(infoPO.getFieldName(), reallyValue);
|
||||
// 上级分部
|
||||
if ("ec_company".equals(infoPO.getFieldName())) {
|
||||
String[] split = cellValue.split(">");
|
||||
if (split.length > 0) {
|
||||
if (split.length > 8) {
|
||||
historyDetailPO.setOperateDetail("分部层级不能大于10");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
for (String s : split) {
|
||||
parentCompanyId = MapperProxyFactory.getProxy(CompMapper.class).getIdByNameAndPid(s, parentCompanyId == null ? 0 : parentCompanyId);
|
||||
if (null == parentCompanyId) {
|
||||
historyDetailPO.setOperateDetail(cellValue + "分部未找到对应数据");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ("ec_department".equals(infoPO.getFieldName())) {
|
||||
String[] split = cellValue.split(">");
|
||||
if (split.length > 0) {
|
||||
if (split.length > 8) {
|
||||
historyDetailPO.setOperateDetail("部门层级不能大于10");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
for (String s : split) {
|
||||
parentDepartmentId = MapperProxyFactory.getProxy(DepartmentMapper.class).getIdByNameAndPid(s, parentCompanyId, parentDepartmentId == null ? 0 : parentDepartmentId);
|
||||
if (null == parentDepartmentId) {
|
||||
historyDetailPO.setOperateDetail(cellValue + "部门未找到对应数据");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ("job_name".equals(infoPO.getFieldName())) {
|
||||
if (null == parentCompanyId) {
|
||||
historyDetailPO.setOperateDetail(cellValue + "所属分部未找到");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
historyDetailPO.setRelatedName(cellValue);
|
||||
String[] split = cellValue.split(">");
|
||||
if (split.length > 0) {
|
||||
if (split.length > 8) {
|
||||
historyDetailPO.setOperateDetail("岗位层级不能大于10");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
for (int index = 0; index < split.length - 1; index++) {
|
||||
parentJobId = MapperProxyFactory.getProxy(JobMapper.class).getIdByNameAndPid(split[index], parentCompanyId, parentDepartmentId == null ? 0 : parentDepartmentId, parentJobId == null ? 0 : parentJobId);
|
||||
if (null == parentJobId) {
|
||||
historyDetailPO.setOperateDetail(split[index] + "岗位未找到对应数据");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
}
|
||||
}
|
||||
map.put("parent_comp", parentCompanyId);
|
||||
map.put("parent_dept", parentDepartmentId);
|
||||
map.put("ec_company", parentCompanyId);
|
||||
map.put("ec_department", parentDepartmentId);
|
||||
map.put("parent_job", parentJobId);
|
||||
jobName = split[split.length - 1];
|
||||
map.put("job_name", jobName);
|
||||
map.put("is_key", StringUtils.isBlank(Util.null2String(map.get("is_key"))) ? 0 : map.get("is_key"));
|
||||
}
|
||||
}
|
||||
}
|
||||
// 校验、数据交互
|
||||
if (i == 0) {
|
||||
continue;
|
||||
}
|
||||
String jobNo = (String) map.get("job_no");
|
||||
Long jobId = MapperProxyFactory.getProxy(JobMapper.class).getIdByNameAndPid(jobName, parentCompanyId, parentDepartmentId == null ? 0 : parentDepartmentId, parentJobId == null ? 0 : parentJobId);
|
||||
if ("add".equals(operateType)) {
|
||||
if (jobId != null) {
|
||||
historyDetailPO.setOperateDetail("数据已存在");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue;
|
||||
}
|
||||
// 自动编号
|
||||
try {
|
||||
jobNo = JobServiceImpl.repeatDetermine(jobNo);
|
||||
} catch (OrganizationRunTimeException e) {
|
||||
historyDetailPO.setOperateDetail(e.getMessage());
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue;
|
||||
}
|
||||
map.put("job_no", jobNo);
|
||||
map.put("creator", user.getUID());
|
||||
map.put("delete_type", 0);
|
||||
map.put("create_time", new Date());
|
||||
// 禁用表示为空,默认启用
|
||||
if (StringUtils.isBlank(Util.null2String(map.get("forbidden_tag")))) {
|
||||
map.put("forbidden_tag", 0);
|
||||
}
|
||||
String showOrder = Util.null2String(map.get("show_order"));
|
||||
if (StringUtils.isBlank(showOrder)) {
|
||||
Integer maxShowOrder = MapperProxyFactory.getProxy(JobMapper.class).getMaxShowOrder();
|
||||
if (null == maxShowOrder) {
|
||||
maxShowOrder = 0;
|
||||
}
|
||||
map.put("show_order", maxShowOrder + 1);
|
||||
}
|
||||
ExtendInfoParams infoParams = ExtendInfoParams.builder().tableName("JCL_ORG_JOB").params(map).build();
|
||||
|
||||
map.put("jobactivityid", JobServiceImpl.JOB_ACTIVITY_ID);
|
||||
Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.JOB, OperateTypeEnum.ADD, map, false).sync();
|
||||
if (OrgImportUtil.isThrowError(syncMap)) {
|
||||
boolean assertNameRepeat = JobServiceImpl.assertNameRepeat(null, Util.null2String(map.get("ec_department")), Util.null2String(map.get("parent_job")), Util.null2String(map.get("job_name")));
|
||||
if (assertNameRepeat) {
|
||||
map.remove("jobactivityid");
|
||||
MapperProxyFactory.getProxy(ExtMapper.class).insertTable(infoParams);
|
||||
// 更新组织架构图
|
||||
new JobTriggerRunnable(infoParams.getId()).run();
|
||||
historyDetailPO.setOperateDetail("添加成功");
|
||||
historyDetailPO.setStatus("1");
|
||||
} else {
|
||||
historyDetailPO.setOperateDetail("岗位名称已存在");
|
||||
historyDetailPO.setStatus("0");
|
||||
}
|
||||
} else {
|
||||
historyDetailPO.setOperateDetail(Util.null2String(syncMap.get("message")));
|
||||
historyDetailPO.setStatus("0");
|
||||
}
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
} else if ("update".equals(operateType)) {
|
||||
// 查询对应ID
|
||||
if (StringUtils.isNotBlank(jobNo)) {
|
||||
if (jobId == null) {
|
||||
historyDetailPO.setOperateDetail("未找到对应数据");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue;
|
||||
}
|
||||
if (checkRepeatNo(jobNo, JOB_TYPE, jobId)) {
|
||||
map.put("update_time", new Date());
|
||||
map.put("jobactivityid", JobServiceImpl.JOB_ACTIVITY_ID);
|
||||
map.put("id", jobId);
|
||||
Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.JOB, OperateTypeEnum.UPDATE, map, MapperProxyFactory.getProxy(JobMapper.class).getJobById(jobId), false).sync();
|
||||
if (OrgImportUtil.isThrowError(syncMap)) {
|
||||
boolean assertNameRepeat = JobServiceImpl.assertNameRepeat(jobId.toString(), Util.null2String(map.get("ec_department")), Util.null2String(map.get("parent_job")), Util.null2String(map.get("job_name")));
|
||||
if (assertNameRepeat) {
|
||||
map.remove("id");
|
||||
map.remove("jobactivityid");
|
||||
MapperProxyFactory.getProxy(ExtMapper.class).updateTable(ExtendInfoParams.builder().id(jobId).tableName("JCL_ORG_JOB").params(map).build());
|
||||
// 更新组织架构图
|
||||
new JobTriggerRunnable(jobId).run();
|
||||
historyDetailPO.setOperateDetail("更新成功");
|
||||
historyDetailPO.setStatus("1");
|
||||
} else {
|
||||
historyDetailPO.setOperateDetail("岗位名称已存在");
|
||||
historyDetailPO.setStatus("0");
|
||||
}
|
||||
} else {
|
||||
historyDetailPO.setOperateDetail(Util.null2String(syncMap.get("message")));
|
||||
historyDetailPO.setStatus("0");
|
||||
}
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
} else {
|
||||
historyDetailPO.setOperateDetail(jobNo + "编号已存在");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
}
|
||||
} else {
|
||||
historyDetailPO.setOperateDetail("编号为空,更新失败");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
}
|
||||
}
|
||||
}
|
||||
return importHistoryId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 方案职等职级导入
|
||||
*/
|
||||
|
|
@ -1029,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.employee.vo.EmployeeTableVO;
|
||||
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.dto.JobListDTO;
|
||||
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.enums.LogModuleNameEnum;
|
||||
import com.engine.organization.enums.OperateTypeEnum;
|
||||
import com.engine.organization.exception.OrganizationRunTimeException;
|
||||
import com.engine.organization.mapper.codesetting.CodeRuleMapper;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
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.service.ExtService;
|
||||
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.util.*;
|
||||
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 org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.StringUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
|
|
@ -203,7 +200,16 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
|
||||
@Override
|
||||
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
|
||||
|
|
@ -214,23 +220,11 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
// 编号
|
||||
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 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<>();
|
||||
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");
|
||||
|
||||
conditionItems.add(jobNoItem);
|
||||
conditionItems.add(jobNameItem);
|
||||
conditionItems.add(jobTitleNameItem);
|
||||
conditionItems.add(parentCompBrowserItem);
|
||||
conditionItems.add(parentDeptBrowserItem);
|
||||
conditionItems.add(sequenceBrowserItem);
|
||||
conditionItems.add(schemeBrowserItem);
|
||||
conditionItems.add(parentJobBrowserItem);
|
||||
conditionItems.add(isKeyItem);
|
||||
conditionItems.add(workplaceItem);
|
||||
conditionItems.add(forbiddenTagItem);
|
||||
|
|
@ -321,7 +312,7 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
List<ExtendTitlePO> extendTitles = getExtendTitleMapper().getTitlesByGroupID(Long.parseLong(groupId), "1");
|
||||
if (CollectionUtils.isNotEmpty(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)) {
|
||||
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) {
|
||||
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
||||
JobSearchParam searchParam = JSONObject.parseObject(JSONObject.toJSONString(params), JobSearchParam.class);
|
||||
assertNameRepeat(null, searchParam.getEcDepartment(), searchParam.getParentJob(), searchParam.getJobName());
|
||||
String jobNo = (String) params.get("job_no");
|
||||
// 判断是否开启自动编号
|
||||
jobNo = repeatDetermine(jobNo);
|
||||
|
|
@ -365,18 +355,13 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
params.put("is_key", null == searchParam.getIsKey() ? 0 : searchParam.getIsKey());
|
||||
if (null != 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_department", parentJob.getEcDepartment());
|
||||
} else {
|
||||
Integer ecDepartment = searchParam.getEcDepartment();
|
||||
DepartmentPO jclDepartment = getDepartmentMapper().getDeptById(ecDepartment);
|
||||
params.put("parent_dept", jclDepartment.getId());
|
||||
params.put("parent_comp", jclDepartment.getSubCompanyId1());
|
||||
if (null != jclDepartment.getSubCompanyId1()) {
|
||||
params.put("ec_company", jclDepartment.getSubCompanyId1());
|
||||
}
|
||||
params.put("ec_company", jclDepartment.getId());
|
||||
params.put("ec_department", jclDepartment.getSubCompanyId1());
|
||||
}
|
||||
|
||||
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) {
|
||||
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
||||
JobSearchParam searchParam = JSONObject.parseObject(JSONObject.toJSONString(params), JobSearchParam.class);
|
||||
assertNameRepeat(searchParam.getId(), searchParam.getEcDepartment(), searchParam.getParentJob(), searchParam.getJobName());
|
||||
String groupId = (String) params.get("viewCondition");
|
||||
searchParam.setIsKey(null == searchParam.getIsKey() ? 0 : searchParam.getIsKey());
|
||||
// 上级岗位不能选择本身
|
||||
|
|
@ -416,27 +400,22 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
params.put("is_key", searchParam.getIsKey());
|
||||
if (null != 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_department", parentJob.getEcDepartment());
|
||||
} else {
|
||||
Integer ecDepartment = searchParam.getEcDepartment();
|
||||
DepartmentPO jclDepartment = getDepartmentMapper().getDeptById(ecDepartment);
|
||||
params.put("parent_dept", jclDepartment.getId());
|
||||
params.put("parent_comp", jclDepartment.getSubCompanyId1());
|
||||
if (null != jclDepartment.getSubCompanyId1()) {
|
||||
params.put("ec_company", jclDepartment.getSubCompanyId1());
|
||||
}
|
||||
params.put("ec_department", jclDepartment.getId());
|
||||
params.put("ec_company", jclDepartment.getSubCompanyId1());
|
||||
}
|
||||
params.put("jobactivityid", JOB_ACTIVITY_ID);
|
||||
new OrganizationSyncEc(user, LogModuleNameEnum.JOB, OperateTypeEnum.UPDATE, params, oldJobPO).sync();
|
||||
getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_JOB, params, "", 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());
|
||||
|
|
@ -463,18 +442,15 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
jobById.setEcDepartment(Integer.parseInt(department));
|
||||
DepartmentPO jclDepartmentId = getDepartmentMapper().getDeptById(jobById.getEcDepartment());
|
||||
if (null != jclDepartmentId) {
|
||||
jobById.setParentDept(jclDepartmentId.getId());
|
||||
//分部赋值
|
||||
jobById.setEcCompany(jclDepartmentId.getSubCompanyId1());
|
||||
jobById.setParentComp(jclDepartmentId.getSubCompanyId1());
|
||||
}
|
||||
// 清空上级岗位
|
||||
jobById.setParentJob(null);
|
||||
jobById.setShowOrder(orderNum);
|
||||
assertNameRepeat(null, jobById.getEcDepartment(), jobById.getParentJob(), jobById.getJobName());
|
||||
insertCount += getJobMapper().insertIgnoreNull(jobById);
|
||||
// 更新组织架构图
|
||||
new JobTriggerRunnable(jobById.getId()).run();
|
||||
//TODO new JobTriggerRunnable(jobById.getId()).run();
|
||||
}
|
||||
|
||||
return insertCount;
|
||||
|
|
@ -484,10 +460,10 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
public int updateForbiddenTagById(JobSearchParam params) {
|
||||
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
||||
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()) {
|
||||
// 启用:判断上级部门是否启用,上级部门启用,岗位才可启用
|
||||
DepartmentPO parentDepartment = getDepartmentMapper().getDeptById(jobById.getParentDept());
|
||||
DepartmentPO parentDepartment = getDepartmentMapper().getDeptById(jobById.getEcDepartment());
|
||||
OrganizationAssert.isTrue(0 == parentDepartment.getCanceled(), "该岗位不能解封,请先解封上级部门");
|
||||
|
||||
// 启用:判断上级岗位是否启用,上级岗位启用,岗位才可启用
|
||||
|
|
@ -497,8 +473,9 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
}
|
||||
} else {
|
||||
//禁用:判断当前岗位下是否有人员,如有人员则不能禁用
|
||||
int hasResource = getJobMapper().isHasResource(params.getId());
|
||||
OrganizationAssert.isTrue(hasResource == 0, "该岗位存在人员,不能封存");
|
||||
// int hasResource = getJobMapper().isHasResource(params.getId());
|
||||
// OrganizationAssert.isTrue(hasResource == 0, "该岗位存在人员,不能封存");
|
||||
throw new OrganizationRunTimeException("该岗位不能封存");
|
||||
}
|
||||
new OrganizationSyncEc(user, LogModuleNameEnum.JOB, OperateTypeEnum.CANCELED, null, jobPO).sync();
|
||||
return getJobMapper().updateForbiddenTagById(jobPO.getId(), jobPO.getForbiddenTag());
|
||||
|
|
@ -522,7 +499,8 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
@Override
|
||||
public Map<String, Object> getHrmListByJobId(Long jobId) {
|
||||
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);
|
||||
result.putAll(table.makeDataResult());
|
||||
result.success();
|
||||
|
|
@ -543,11 +521,6 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
deptBrowserItem.setBrowserConditionParam(customBrowserBean);
|
||||
SearchConditionItem mergeNameItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 3, 50, "合并后名称", "mergeName");
|
||||
mergeNameItem.setRules("required|string");
|
||||
JobPO jobById = getJobMapper().getJobById(id);
|
||||
if (null != jobById) {
|
||||
String jobName = jobById.getJobName();
|
||||
mergeNameItem.setValue(jobName);
|
||||
}
|
||||
condition.add(deptBrowserItem);
|
||||
condition.add(mergeNameItem);
|
||||
addGroups.add(new SearchConditionGroup("", true, condition));
|
||||
|
|
@ -576,45 +549,42 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
|
||||
// 待合并的部门
|
||||
JobPO jobById = getJobMapper().getJobById(mergeParam.getId());
|
||||
assertNameRepeat(targetJob.getId(), targetJob.getEcDepartment(), targetJob.getParentJob(), mergeParam.getMergeName());
|
||||
|
||||
// 递归处理子岗位所属分部、所部部门、上级岗位
|
||||
recursionMergeJob(jobs, targetJob.getParentComp(), targetJob.getEcCompany(), targetJob.getParentDept(), targetJob.getEcDepartment(), targetJob.getId());
|
||||
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);
|
||||
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();
|
||||
getJobMapper().deleteByIds(Collections.singletonList(jobById.getId()));
|
||||
// 更新组织架构图
|
||||
new JobTriggerRunnable(jobById).run();
|
||||
//TODO new JobTriggerRunnable(jobById).run();
|
||||
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) {
|
||||
job.setParentComp(parentCompany);
|
||||
job.setEcCompany(ecCompany);
|
||||
job.setParentDept(parentDepartment);
|
||||
job.setEcDepartment(ecDepartment);
|
||||
job.setParentJob(parentJob);
|
||||
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());
|
||||
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) {
|
||||
return !(StringUtil.isEmpty(jobPO.getJobNo())
|
||||
&& StringUtil.isEmpty(jobPO.getJobName())
|
||||
&& StringUtil.isEmpty(jobPO.getJobTitleName())
|
||||
&& StringUtil.isEmpty(jobPO.getWorkplace())
|
||||
&& StringUtil.isEmpty(jobPO.getDescription())
|
||||
&& StringUtil.isEmpty(jobPO.getWorkDuty())
|
||||
&& StringUtil.isEmpty(jobPO.getWorkAuthority())
|
||||
&& null == jobPO.getParentComp()
|
||||
&& null == jobPO.getParentDept()
|
||||
&& null == jobPO.getParentJob()
|
||||
&& null == jobPO.getSequenceId()
|
||||
&& null == jobPO.getSchemeId()
|
||||
|
|
@ -738,6 +706,7 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
&& null == jobPO.getForbiddenTag()
|
||||
&& null == jobPO.getEcCompany()
|
||||
&& null == jobPO.getEcDepartment()
|
||||
&& null == jobPO.getEcJobTitle()
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -787,95 +756,19 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新EC岗位
|
||||
*
|
||||
* @param jobPO
|
||||
*/
|
||||
private void updateEcJob(JobPO jobPO, String newName) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("job_name", newName);
|
||||
params.put("jobactivityid", JOB_ACTIVITY_ID);
|
||||
params.put("work_duty", jobPO.getWorkDuty());
|
||||
params.put("work_authority", jobPO.getWorkAuthority());
|
||||
params.put("description", jobPO.getDescription());
|
||||
params.put("job_no", jobPO.getJobNo());
|
||||
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);
|
||||
}
|
||||
///**
|
||||
// * 更新EC岗位
|
||||
// *
|
||||
// * @param jobPO
|
||||
// */
|
||||
//private void updateEcJob(JobPO jobPO, String newName) {
|
||||
// Map<String, Object> params = new HashMap<>();
|
||||
// params.put("job_name", newName);
|
||||
// params.put("jobactivityid", JOB_ACTIVITY_ID);
|
||||
// params.put("work_duty", jobPO.getWorkDuty());
|
||||
// params.put("work_authority", jobPO.getWorkAuthority());
|
||||
// params.put("description", jobPO.getDescription());
|
||||
// params.put("job_no", jobPO.getJobNo());
|
||||
// new OrganizationSyncEc(user, LogModuleNameEnum.JOB, OperateTypeEnum.UPDATE, params, jobPO).sync();
|
||||
//}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -448,9 +448,9 @@ public class StaffServiceImpl extends Service implements StaffService {
|
|||
OrganizationAssert.notNull(staffPO.getJobId(), "编制维度选择岗位时,岗位必填!");
|
||||
JobPO jobById = getJobMapper().getJobById(staffPO.getJobId());
|
||||
if (null != jobById) {
|
||||
staffPO.setDeptId(jobById.getParentDept());
|
||||
staffPO.setDeptId(jobById.getEcDepartment());
|
||||
staffPO.setEcDepartment(jobById.getEcDepartment());
|
||||
staffPO.setCompId(jobById.getParentComp());
|
||||
staffPO.setCompId(jobById.getEcCompany());
|
||||
staffPO.setEcCompany(jobById.getEcCompany());
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1,98 +1,98 @@
|
|||
package com.engine.organization.thread;
|
||||
|
||||
import com.engine.organization.entity.hrmresource.po.HrmResourcePO;
|
||||
import com.engine.organization.entity.map.JclOrgMap;
|
||||
import com.engine.organization.mapper.jclorgmap.JclOrgMapper;
|
||||
import com.engine.organization.mapper.trigger.CompTriggerMapper;
|
||||
import com.engine.organization.mapper.trigger.GroupTriggerMapper;
|
||||
import com.engine.organization.util.OrganizationDateUtil;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.passwordprotection.domain.HrmResource;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.util.Calendar;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/08/30
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class GroupTriggerRunnable implements Runnable {
|
||||
Map<String, Object> params;
|
||||
|
||||
private CompTriggerMapper getCompTriggerMapper() {
|
||||
return MapperProxyFactory.getProxy(CompTriggerMapper.class);
|
||||
}
|
||||
|
||||
private GroupTriggerMapper getGroupTriggerMapper() {
|
||||
return MapperProxyFactory.getProxy(GroupTriggerMapper.class);
|
||||
}
|
||||
|
||||
public GroupTriggerRunnable(Map<String, Object> params) {
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
JclOrgMap jclOrgMap = new JclOrgMap();
|
||||
//id = 0;
|
||||
jclOrgMap.setId(0);
|
||||
//ftype = 0;
|
||||
jclOrgMap.setFType(0);
|
||||
jclOrgMap.setFObjId(0);
|
||||
jclOrgMap.setFEcId(parseString2Int(params.get("id")));
|
||||
jclOrgMap.setUuid(Util.null2String(params.get("uuid")));
|
||||
jclOrgMap.setFNumber("00");
|
||||
jclOrgMap.setFName(Util.null2String(params.get("companyname")));
|
||||
jclOrgMap.setFClass(0);
|
||||
jclOrgMap.setFClassName("行政维度");
|
||||
jclOrgMap.setFLeader(getGroupTriggerMapper().getInfoValue(1));
|
||||
HrmResource hrmResourceById = getCompTriggerMapper().getHrmResourceById(jclOrgMap.getFLeader());
|
||||
if (null != hrmResourceById) {
|
||||
jclOrgMap.setFLeaderImg(hrmResourceById.getMessagerurl());
|
||||
jclOrgMap.setFLeaderName(hrmResourceById.getLastname());
|
||||
jclOrgMap.setFLeaderJobId(hrmResourceById.getJobtitle());
|
||||
}
|
||||
jclOrgMap.setFLeaderJob(getCompTriggerMapper().getJobTitleMarkById(jclOrgMap.getFLeaderJobId()));
|
||||
HrmResourcePO resourceByEcId = getCompTriggerMapper().getResourceByEcId(jclOrgMap.getFLeader());
|
||||
if (null != resourceByEcId) {
|
||||
jclOrgMap.setFLeaderSt(resourceByEcId.getJobGrade());
|
||||
jclOrgMap.setFLeaderLv(resourceByEcId.getJobLevel());
|
||||
}
|
||||
jclOrgMap.setFParentId(-1);
|
||||
jclOrgMap.setFObjParentId(0);
|
||||
String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date());
|
||||
jclOrgMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
|
||||
jclOrgMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
|
||||
JclOrgMap jclOrgMapByObjID = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapByObjID(jclOrgMap.getFDateBegin(), "0", jclOrgMap.getFObjId().toString());
|
||||
if (null != jclOrgMapByObjID) {
|
||||
jclOrgMap.setFPlan(jclOrgMapByObjID.getFPlan());
|
||||
jclOrgMap.setFOnJob(jclOrgMapByObjID.getFOnJob());
|
||||
} else {
|
||||
jclOrgMap.setFPlan(0);
|
||||
jclOrgMap.setFOnJob(0);
|
||||
}
|
||||
jclOrgMap.setFIsVitual(0);
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(jclOrgMap.getFDateBegin());
|
||||
Calendar calendar = DateUtil.addDay(cal, -1);
|
||||
Date time = new Date(calendar.getTime().getTime());
|
||||
getGroupTriggerMapper().deleteMap(0, jclOrgMap.getFDateBegin());
|
||||
getGroupTriggerMapper().updateMap(0, jclOrgMap.getFDateBegin(), time);
|
||||
|
||||
MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(jclOrgMap);
|
||||
}
|
||||
|
||||
private Integer parseString2Int(Object args) {
|
||||
String s = Util.null2String(args);
|
||||
if (StringUtils.isBlank(s)) {
|
||||
return null;
|
||||
}
|
||||
return Integer.parseInt(s);
|
||||
}
|
||||
}
|
||||
//package com.engine.organization.thread;
|
||||
//
|
||||
//import com.engine.organization.entity.hrmresource.po.HrmResourcePO;
|
||||
//import com.engine.organization.entity.map.JclOrgMap;
|
||||
//import com.engine.organization.mapper.jclorgmap.JclOrgMapper;
|
||||
//import com.engine.organization.mapper.trigger.CompTriggerMapper;
|
||||
//import com.engine.organization.mapper.trigger.GroupTriggerMapper;
|
||||
//import com.engine.organization.util.OrganizationDateUtil;
|
||||
//import com.engine.organization.util.db.MapperProxyFactory;
|
||||
//import org.apache.commons.lang3.StringUtils;
|
||||
//import weaver.common.DateUtil;
|
||||
//import weaver.general.Util;
|
||||
//import weaver.hrm.passwordprotection.domain.HrmResource;
|
||||
//
|
||||
//import java.sql.Date;
|
||||
//import java.util.Calendar;
|
||||
//import java.util.Map;
|
||||
//
|
||||
///**
|
||||
// * @author:dxfeng
|
||||
// * @createTime: 2022/08/30
|
||||
// * @version: 1.0
|
||||
// */
|
||||
//public class GroupTriggerRunnable implements Runnable {
|
||||
// Map<String, Object> params;
|
||||
//
|
||||
// private CompTriggerMapper getCompTriggerMapper() {
|
||||
// return MapperProxyFactory.getProxy(CompTriggerMapper.class);
|
||||
// }
|
||||
//
|
||||
// private GroupTriggerMapper getGroupTriggerMapper() {
|
||||
// return MapperProxyFactory.getProxy(GroupTriggerMapper.class);
|
||||
// }
|
||||
//
|
||||
// public GroupTriggerRunnable(Map<String, Object> params) {
|
||||
// this.params = params;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Override
|
||||
// public void run() {
|
||||
// JclOrgMap jclOrgMap = new JclOrgMap();
|
||||
// //id = 0;
|
||||
// jclOrgMap.setId(0);
|
||||
// //ftype = 0;
|
||||
// jclOrgMap.setFType(0);
|
||||
// jclOrgMap.setFObjId(0);
|
||||
// jclOrgMap.setFEcId(parseString2Int(params.get("id")));
|
||||
// jclOrgMap.setUuid(Util.null2String(params.get("uuid")));
|
||||
// jclOrgMap.setFNumber("00");
|
||||
// jclOrgMap.setFName(Util.null2String(params.get("companyname")));
|
||||
// jclOrgMap.setFClass(0);
|
||||
// jclOrgMap.setFClassName("行政维度");
|
||||
// jclOrgMap.setFLeader(getGroupTriggerMapper().getInfoValue(1));
|
||||
// HrmResource hrmResourceById = getCompTriggerMapper().getHrmResourceById(jclOrgMap.getFLeader());
|
||||
// if (null != hrmResourceById) {
|
||||
// jclOrgMap.setFLeaderImg(hrmResourceById.getMessagerurl());
|
||||
// jclOrgMap.setFLeaderName(hrmResourceById.getLastname());
|
||||
// jclOrgMap.setFLeaderJobId(hrmResourceById.getJobtitle());
|
||||
// }
|
||||
// jclOrgMap.setFLeaderJob(getCompTriggerMapper().getJobTitleMarkById(jclOrgMap.getFLeaderJobId()));
|
||||
// HrmResourcePO resourceByEcId = getCompTriggerMapper().getResourceByEcId(jclOrgMap.getFLeader());
|
||||
// if (null != resourceByEcId) {
|
||||
// jclOrgMap.setFLeaderSt(resourceByEcId.getJobGrade());
|
||||
// jclOrgMap.setFLeaderLv(resourceByEcId.getJobLevel());
|
||||
// }
|
||||
// jclOrgMap.setFParentId(-1);
|
||||
// jclOrgMap.setFObjParentId(0);
|
||||
// String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date());
|
||||
// jclOrgMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
|
||||
// jclOrgMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
|
||||
// JclOrgMap jclOrgMapByObjID = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapByObjID(jclOrgMap.getFDateBegin(), "0", jclOrgMap.getFObjId().toString());
|
||||
// if (null != jclOrgMapByObjID) {
|
||||
// jclOrgMap.setFPlan(jclOrgMapByObjID.getFPlan());
|
||||
// jclOrgMap.setFOnJob(jclOrgMapByObjID.getFOnJob());
|
||||
// } else {
|
||||
// jclOrgMap.setFPlan(0);
|
||||
// jclOrgMap.setFOnJob(0);
|
||||
// }
|
||||
// jclOrgMap.setFIsVitual(0);
|
||||
// Calendar cal = Calendar.getInstance();
|
||||
// cal.setTime(jclOrgMap.getFDateBegin());
|
||||
// Calendar calendar = DateUtil.addDay(cal, -1);
|
||||
// Date time = new Date(calendar.getTime().getTime());
|
||||
// getGroupTriggerMapper().deleteMap(0, jclOrgMap.getFDateBegin());
|
||||
// getGroupTriggerMapper().updateMap(0, jclOrgMap.getFDateBegin(), time);
|
||||
//
|
||||
// MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(jclOrgMap);
|
||||
// }
|
||||
//
|
||||
// private Integer parseString2Int(Object args) {
|
||||
// String s = Util.null2String(args);
|
||||
// if (StringUtils.isBlank(s)) {
|
||||
// return null;
|
||||
// }
|
||||
// return Integer.parseInt(s);
|
||||
// }
|
||||
//}
|
||||
|
|
|
|||
|
|
@ -1,114 +1,114 @@
|
|||
package com.engine.organization.thread;
|
||||
|
||||
import com.engine.organization.entity.hrmresource.po.HrmResourcePO;
|
||||
import com.engine.organization.entity.job.po.JobPO;
|
||||
import com.engine.organization.entity.map.JclOrgMap;
|
||||
import com.engine.organization.entity.personnelcard.UserCard;
|
||||
import com.engine.organization.mapper.jclorgmap.JclOrgMapper;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
import com.engine.organization.mapper.resource.ResourceMapper;
|
||||
import com.engine.organization.mapper.trigger.CompTriggerMapper;
|
||||
import com.engine.organization.mapper.trigger.HrmResourceTriggerMapper;
|
||||
import com.engine.organization.util.OrganizationDateUtil;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.hrm.passwordprotection.domain.HrmResource;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/09/01
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class HrmResourceTriggerRunnable implements Runnable {
|
||||
Long userId;
|
||||
|
||||
private CompTriggerMapper getCompTriggerMapper() {
|
||||
return MapperProxyFactory.getProxy(CompTriggerMapper.class);
|
||||
}
|
||||
|
||||
private HrmResourceTriggerMapper getHrmResourceTriggerMapper() {
|
||||
return MapperProxyFactory.getProxy(HrmResourceTriggerMapper.class);
|
||||
}
|
||||
private ResourceMapper getResourceMapper() {
|
||||
return MapperProxyFactory.getProxy(ResourceMapper.class);
|
||||
}
|
||||
private JclOrgMapper getJclOrgMapper() {
|
||||
return MapperProxyFactory.getProxy(JclOrgMapper.class);
|
||||
}
|
||||
|
||||
public HrmResourceTriggerRunnable(Long id) {
|
||||
this.userId = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
int st = 100000000;
|
||||
int sj = 200000000;
|
||||
int sk = 300000000;
|
||||
Integer delete = null;
|
||||
JclOrgMap jclMap = new JclOrgMap();
|
||||
jclMap.setFType(4);
|
||||
// 查询当前人员信息数据
|
||||
String ecResourceId = getResourceMapper().getEcResourceId(userId.toString());
|
||||
// EC人员
|
||||
HrmResource ecHrmResource = getHrmResourceTriggerMapper().getHrmResource(Long.parseLong(ecResourceId));
|
||||
// 聚才林人员
|
||||
HrmResourcePO hrmResource = getCompTriggerMapper().getResourceByEcId(Integer.parseInt(ecResourceId));
|
||||
if (null != hrmResource && null!=ecHrmResource) {
|
||||
jclMap.setFObjId(hrmResource.getId().intValue());
|
||||
jclMap.setId(hrmResource.getId().intValue() + sk);
|
||||
jclMap.setFEcId(ecHrmResource.getId());
|
||||
jclMap.setFNumber(hrmResource.getWorkCode());
|
||||
jclMap.setFName(hrmResource.getLastName());
|
||||
jclMap.setUuid(hrmResource.getUuid());
|
||||
delete = hrmResource.getStatus() < 4 ? 0 : 1;
|
||||
// 展示为花名册上传的照片
|
||||
String image = UserCard.builder().image(hrmResource.getResourceImageId()).build().getImage();
|
||||
jclMap.setFLeaderImg(image);
|
||||
jclMap.setFLeaderName(hrmResource.getLastName());
|
||||
jclMap.setFLeaderJobId(hrmResource.getJobTitle().intValue());
|
||||
if (null != hrmResource.getJobTitle()) {
|
||||
JobPO jobById = MapperProxyFactory.getProxy(JobMapper.class).getJobById(hrmResource.getJobTitle());
|
||||
if (null != jobById) {
|
||||
jclMap.setFLeaderJob(jobById.getJobName());
|
||||
}
|
||||
jclMap.setFObjParentId(hrmResource.getJobTitle().intValue());
|
||||
jclMap.setFParentId(jclMap.getFObjParentId() + sj);
|
||||
}
|
||||
jclMap.setFLeaderSt(hrmResource.getJobGrade());
|
||||
jclMap.setFLeaderLv(hrmResource.getJobLevel());
|
||||
jclMap.setFClass(0);
|
||||
jclMap.setFClassName("行政维度");
|
||||
String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date());
|
||||
jclMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
|
||||
jclMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
|
||||
jclMap.setFIsVitual(0);
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(jclMap.getFDateBegin());
|
||||
Calendar calendar = DateUtil.addDay(cal, -1);
|
||||
Date time = new Date(calendar.getTime().getTime());
|
||||
// 更新前的数据
|
||||
JclOrgMap jclOrgMapByObjID = getJclOrgMapper().getJclOrgMapByObjID(jclMap.getFDateBegin(), "4", hrmResource.getId().toString());
|
||||
|
||||
getCompTriggerMapper().deleteMap(jclMap.getFType(), jclMap.getFObjId(), jclMap.getFDateBegin());
|
||||
getCompTriggerMapper().updateMap(jclMap.getFType(), jclMap.getFObjId(), jclMap.getFDateBegin(), time);
|
||||
if (0 == delete) {
|
||||
MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(jclMap);
|
||||
// 更新当前架构图负责人的卡片信息
|
||||
getHrmResourceTriggerMapper().updateLeaders(jclMap.getFDateBegin(), hrmResource.getId().toString(), jclMap.getFLeaderImg(), jclMap.getFLeaderName(), jclMap.getFLeaderJobId(), jclMap.getFLeaderJob(), jclMap.getFLeaderLv(), jclMap.getFLeaderSt());
|
||||
// 更新组织架构图在岗数
|
||||
if (null != jclOrgMapByObjID) {
|
||||
new StaffTriggerRunnable(jclOrgMapByObjID.getFObjParentId()).run();
|
||||
}
|
||||
new StaffTriggerRunnable(jclMap.getFObjParentId()).run();
|
||||
|
||||
} else if (null != jclOrgMapByObjID) {
|
||||
new StaffTriggerRunnable(jclOrgMapByObjID.getFObjParentId()).run();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//package com.engine.organization.thread;
|
||||
//
|
||||
//import com.engine.organization.entity.hrmresource.po.HrmResourcePO;
|
||||
//import com.engine.organization.entity.job.po.JobPO;
|
||||
//import com.engine.organization.entity.map.JclOrgMap;
|
||||
//import com.engine.organization.entity.personnelcard.UserCard;
|
||||
//import com.engine.organization.mapper.jclorgmap.JclOrgMapper;
|
||||
//import com.engine.organization.mapper.job.JobMapper;
|
||||
//import com.engine.organization.mapper.resource.ResourceMapper;
|
||||
//import com.engine.organization.mapper.trigger.CompTriggerMapper;
|
||||
//import com.engine.organization.mapper.trigger.HrmResourceTriggerMapper;
|
||||
//import com.engine.organization.util.OrganizationDateUtil;
|
||||
//import com.engine.organization.util.db.MapperProxyFactory;
|
||||
//import weaver.common.DateUtil;
|
||||
//import weaver.hrm.passwordprotection.domain.HrmResource;
|
||||
//
|
||||
//import java.sql.Date;
|
||||
//import java.util.Calendar;
|
||||
//
|
||||
///**
|
||||
// * @author:dxfeng
|
||||
// * @createTime: 2022/09/01
|
||||
// * @version: 1.0
|
||||
// */
|
||||
//public class HrmResourceTriggerRunnable implements Runnable {
|
||||
// Long userId;
|
||||
//
|
||||
// private CompTriggerMapper getCompTriggerMapper() {
|
||||
// return MapperProxyFactory.getProxy(CompTriggerMapper.class);
|
||||
// }
|
||||
//
|
||||
// private HrmResourceTriggerMapper getHrmResourceTriggerMapper() {
|
||||
// return MapperProxyFactory.getProxy(HrmResourceTriggerMapper.class);
|
||||
// }
|
||||
// private ResourceMapper getResourceMapper() {
|
||||
// return MapperProxyFactory.getProxy(ResourceMapper.class);
|
||||
// }
|
||||
// private JclOrgMapper getJclOrgMapper() {
|
||||
// return MapperProxyFactory.getProxy(JclOrgMapper.class);
|
||||
// }
|
||||
//
|
||||
// public HrmResourceTriggerRunnable(Long id) {
|
||||
// this.userId = id;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void run() {
|
||||
// int st = 100000000;
|
||||
// int sj = 200000000;
|
||||
// int sk = 300000000;
|
||||
// Integer delete = null;
|
||||
// JclOrgMap jclMap = new JclOrgMap();
|
||||
// jclMap.setFType(4);
|
||||
// // 查询当前人员信息数据
|
||||
// String ecResourceId = getResourceMapper().getEcResourceId(userId.toString());
|
||||
// // EC人员
|
||||
// HrmResource ecHrmResource = getHrmResourceTriggerMapper().getHrmResource(Long.parseLong(ecResourceId));
|
||||
// // 聚才林人员
|
||||
// HrmResourcePO hrmResource = getCompTriggerMapper().getResourceByEcId(Integer.parseInt(ecResourceId));
|
||||
// if (null != hrmResource && null!=ecHrmResource) {
|
||||
// jclMap.setFObjId(hrmResource.getId().intValue());
|
||||
// jclMap.setId(hrmResource.getId().intValue() + sk);
|
||||
// jclMap.setFEcId(ecHrmResource.getId());
|
||||
// jclMap.setFNumber(hrmResource.getWorkCode());
|
||||
// jclMap.setFName(hrmResource.getLastName());
|
||||
// jclMap.setUuid(hrmResource.getUuid());
|
||||
// delete = hrmResource.getStatus() < 4 ? 0 : 1;
|
||||
// // 展示为花名册上传的照片
|
||||
// String image = UserCard.builder().image(hrmResource.getResourceImageId()).build().getImage();
|
||||
// jclMap.setFLeaderImg(image);
|
||||
// jclMap.setFLeaderName(hrmResource.getLastName());
|
||||
// jclMap.setFLeaderJobId(hrmResource.getJobTitle().intValue());
|
||||
// if (null != hrmResource.getJobTitle()) {
|
||||
// JobPO jobById = MapperProxyFactory.getProxy(JobMapper.class).getJobById(hrmResource.getJobTitle());
|
||||
// if (null != jobById) {
|
||||
// jclMap.setFLeaderJob(jobById.getJobName());
|
||||
// }
|
||||
// jclMap.setFObjParentId(hrmResource.getJobTitle().intValue());
|
||||
// jclMap.setFParentId(jclMap.getFObjParentId() + sj);
|
||||
// }
|
||||
// jclMap.setFLeaderSt(hrmResource.getJobGrade());
|
||||
// jclMap.setFLeaderLv(hrmResource.getJobLevel());
|
||||
// jclMap.setFClass(0);
|
||||
// jclMap.setFClassName("行政维度");
|
||||
// String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date());
|
||||
// jclMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
|
||||
// jclMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
|
||||
// jclMap.setFIsVitual(0);
|
||||
//
|
||||
// Calendar cal = Calendar.getInstance();
|
||||
// cal.setTime(jclMap.getFDateBegin());
|
||||
// Calendar calendar = DateUtil.addDay(cal, -1);
|
||||
// Date time = new Date(calendar.getTime().getTime());
|
||||
// // 更新前的数据
|
||||
// JclOrgMap jclOrgMapByObjID = getJclOrgMapper().getJclOrgMapByObjID(jclMap.getFDateBegin(), "4", hrmResource.getId().toString());
|
||||
//
|
||||
// getCompTriggerMapper().deleteMap(jclMap.getFType(), jclMap.getFObjId(), jclMap.getFDateBegin());
|
||||
// getCompTriggerMapper().updateMap(jclMap.getFType(), jclMap.getFObjId(), jclMap.getFDateBegin(), time);
|
||||
// if (0 == delete) {
|
||||
// MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(jclMap);
|
||||
// // 更新当前架构图负责人的卡片信息
|
||||
// getHrmResourceTriggerMapper().updateLeaders(jclMap.getFDateBegin(), hrmResource.getId().toString(), jclMap.getFLeaderImg(), jclMap.getFLeaderName(), jclMap.getFLeaderJobId(), jclMap.getFLeaderJob(), jclMap.getFLeaderLv(), jclMap.getFLeaderSt());
|
||||
// // 更新组织架构图在岗数
|
||||
// if (null != jclOrgMapByObjID) {
|
||||
// new StaffTriggerRunnable(jclOrgMapByObjID.getFObjParentId()).run();
|
||||
// }
|
||||
// new StaffTriggerRunnable(jclMap.getFObjParentId()).run();
|
||||
//
|
||||
// } else if (null != jclOrgMapByObjID) {
|
||||
// new StaffTriggerRunnable(jclOrgMapByObjID.getFObjParentId()).run();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
|
|
|||
|
|
@ -1,202 +1,202 @@
|
|||
package com.engine.organization.thread;
|
||||
|
||||
import com.engine.organization.entity.job.po.JobPO;
|
||||
import com.engine.organization.entity.logview.bo.FieldBaseEquator;
|
||||
import com.engine.organization.entity.map.JclOrgMap;
|
||||
import com.engine.organization.entity.staff.po.StaffPO;
|
||||
import com.engine.organization.enums.ModuleTypeEnum;
|
||||
import com.engine.organization.mapper.jclorgmap.JclOrgMapper;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
import com.engine.organization.mapper.staff.StaffMapper;
|
||||
import com.engine.organization.mapper.trigger.CompTriggerMapper;
|
||||
import com.engine.organization.mapper.trigger.JobTriggerMapper;
|
||||
import com.engine.organization.util.OrganizationDateUtil;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import weaver.common.DateUtil;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/08/30
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class JobTriggerRunnable implements Runnable {
|
||||
|
||||
private final JobPO oldJob;
|
||||
private final JobPO newJob;
|
||||
private Boolean forbiddenTag = false;
|
||||
|
||||
private CompTriggerMapper getCompTriggerMapper() {
|
||||
return MapperProxyFactory.getProxy(CompTriggerMapper.class);
|
||||
}
|
||||
|
||||
private JobTriggerMapper getJobTriggerMapper() {
|
||||
return MapperProxyFactory.getProxy(JobTriggerMapper.class);
|
||||
}
|
||||
|
||||
public JobTriggerRunnable(JobPO oldJob, JobPO newJob) {
|
||||
this.oldJob = oldJob;
|
||||
this.newJob = newJob;
|
||||
}
|
||||
|
||||
public JobTriggerRunnable(Boolean forbiddenTag, JobPO oldJob, JobPO newJob) {
|
||||
this.oldJob = oldJob;
|
||||
this.newJob = newJob;
|
||||
this.forbiddenTag = forbiddenTag;
|
||||
}
|
||||
|
||||
public JobTriggerRunnable(Long jobId) {
|
||||
this.oldJob = new JobPO();
|
||||
this.newJob = MapperProxyFactory.getProxy(JobMapper.class).getJobById(jobId);
|
||||
}
|
||||
|
||||
public JobTriggerRunnable(Long oldJobId, Long newJobId) {
|
||||
this.oldJob = MapperProxyFactory.getProxy(JobMapper.class).getJobById(oldJobId);
|
||||
this.newJob = MapperProxyFactory.getProxy(JobMapper.class).getJobById(newJobId);
|
||||
}
|
||||
|
||||
public JobTriggerRunnable(JobPO newJob) {
|
||||
this.oldJob = new JobPO();
|
||||
this.newJob = newJob;
|
||||
this.newJob.setDeleteType(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
FieldBaseEquator fieldBaseEquator = new FieldBaseEquator();
|
||||
List<String> diffFields = fieldBaseEquator.getDiffFieldList(oldJob, newJob);
|
||||
if (CollectionUtils.isEmpty(diffFields)) {
|
||||
return;
|
||||
}
|
||||
// 判断
|
||||
JclOrgMap jclMap = new JclOrgMap();
|
||||
int st = 100000000;
|
||||
int sj = 200000000;
|
||||
jclMap.setFType(3);
|
||||
// 更新逻辑
|
||||
jclMap.setFObjId(newJob.getId().intValue());
|
||||
jclMap.setId(newJob.getId().intValue() + sj);
|
||||
jclMap.setFNumber(newJob.getJobNo());
|
||||
jclMap.setFName(newJob.getJobName());
|
||||
jclMap.setFParentId(null == newJob.getParentJob() ? newJob.getParentDept().intValue() + st : newJob.getParentJob().intValue() + sj);
|
||||
jclMap.setFObjParentId(null == newJob.getParentJob() ? newJob.getParentDept().intValue() : newJob.getParentJob().intValue());
|
||||
Integer parentdept = newJob.getParentDept().intValue();
|
||||
|
||||
jclMap.setFClass(0);
|
||||
jclMap.setFClassName("行政维度");
|
||||
|
||||
String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date());
|
||||
jclMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
|
||||
jclMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
|
||||
|
||||
JclOrgMap jclOrgMapByObjID = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapByObjID(jclMap.getFDateBegin(), ModuleTypeEnum.jobfielddefined.getValue().toString(), jclMap.getFObjId().toString());
|
||||
|
||||
// 该岗位有下级岗位时,查询
|
||||
JclOrgMap jclOrgMap = MapperProxyFactory.getProxy(JclOrgMapper.class).getSumPlanAndJobByFParentId(jclMap.getFDateBegin(), jclMap.getId().toString());
|
||||
|
||||
StaffPO staffPO = new StaffPO();
|
||||
switch (jclMap.getFType()) {
|
||||
// 部门
|
||||
case 2:
|
||||
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(2, null, jclMap.getFObjId().toString(), null);
|
||||
break;
|
||||
// 岗位
|
||||
case 3:
|
||||
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(3, null, null, jclMap.getFObjId().toString());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (null != jclOrgMapByObjID) {
|
||||
if (null != jclOrgMap) {
|
||||
jclMap.setFPlan((null != staffPO ? staffPO.getStaffNum() : 0) + jclOrgMap.getFPlan());
|
||||
jclMap.setFOnJob(jclOrgMapByObjID.getFOnJob() + jclOrgMap.getFOnJob());
|
||||
} else {
|
||||
jclMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
|
||||
jclMap.setFOnJob(jclOrgMapByObjID.getFOnJob());
|
||||
}
|
||||
} else {
|
||||
jclMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
|
||||
jclMap.setFOnJob(0);
|
||||
}
|
||||
jclMap.setFIsVitual(0);
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(jclMap.getFDateBegin());
|
||||
Calendar calendar = DateUtil.addDay(cal, -1);
|
||||
Date time = new Date(calendar.getTime().getTime());
|
||||
getCompTriggerMapper().deleteMap(jclMap.getFType(), jclMap.getFObjId(), jclMap.getFDateBegin());
|
||||
getCompTriggerMapper().updateMap(jclMap.getFType(), jclMap.getFObjId(), jclMap.getFDateBegin(), time);
|
||||
|
||||
if (1 != newJob.getDeleteType() && 1 != newJob.getForbiddenTag()) {
|
||||
MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(jclMap);
|
||||
}
|
||||
if (null != jclOrgMapByObjID) {
|
||||
if (null != jclOrgMapByObjID.getFParentId()) {
|
||||
updateParentPlanAndJob(jclMap.getFDateBegin(), jclOrgMapByObjID.getFParentId().toString());
|
||||
}
|
||||
}
|
||||
// 部门启用,刷新上级数据
|
||||
if (forbiddenTag) {
|
||||
updateParentPlanAndJob(jclMap.getFDateBegin(), jclMap.getFParentId().toString());
|
||||
}
|
||||
if (null != oldJob) {
|
||||
if (null != oldJob.getId()) {
|
||||
updateParentPlanAndJob(jclMap.getFDateBegin(), oldJob.getId().toString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新上级部门在编、在岗数
|
||||
*/
|
||||
void updateParentPlanAndJob(Date currentDate, String parentId) {
|
||||
JclOrgMap parentJclOrgMap = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapById(currentDate, parentId);
|
||||
if (null != parentJclOrgMap) {
|
||||
// 上级部门当前在编、在岗数
|
||||
JclOrgMap jclOrgMapSum = MapperProxyFactory.getProxy(JclOrgMapper.class).getSumPlanAndJobByFParentId(currentDate, parentJclOrgMap.getId().toString());
|
||||
StaffPO staffPO = new StaffPO();
|
||||
switch (parentJclOrgMap.getFType()) {
|
||||
// 分部
|
||||
case 1:
|
||||
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(1, parentJclOrgMap.getFObjId().toString(), null, null);
|
||||
break;
|
||||
// 部门
|
||||
case 2:
|
||||
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(2, null, parentJclOrgMap.getFObjId().toString(), null);
|
||||
break;
|
||||
// 岗位
|
||||
case 3:
|
||||
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(3, null, parentJclOrgMap.getFObjId().toString(), null);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (null != jclOrgMapSum) {
|
||||
parentJclOrgMap.setFPlan((null != staffPO ? staffPO.getStaffNum() : 0) + jclOrgMapSum.getFPlan());
|
||||
parentJclOrgMap.setFOnJob(jclOrgMapSum.getFOnJob());
|
||||
} else {
|
||||
parentJclOrgMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
|
||||
parentJclOrgMap.setFOnJob(0);
|
||||
}
|
||||
parentJclOrgMap.setFDateBegin(currentDate);
|
||||
parentJclOrgMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(parentJclOrgMap.getFDateBegin());
|
||||
Calendar calendar = DateUtil.addDay(cal, -1);
|
||||
Date time = new Date(calendar.getTime().getTime());
|
||||
getCompTriggerMapper().deleteMap(parentJclOrgMap.getFType(), parentJclOrgMap.getFObjId(), parentJclOrgMap.getFDateBegin());
|
||||
getCompTriggerMapper().updateMap(parentJclOrgMap.getFType(), parentJclOrgMap.getFObjId(), parentJclOrgMap.getFDateBegin(), time);
|
||||
MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(parentJclOrgMap);
|
||||
if (null != parentJclOrgMap.getFParentId() && -1 != parentJclOrgMap.getFParentId()) {
|
||||
updateParentPlanAndJob(currentDate, parentJclOrgMap.getFParentId().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//package com.engine.organization.thread;
|
||||
//
|
||||
//import com.engine.organization.entity.job.po.JobPO;
|
||||
//import com.engine.organization.entity.logview.bo.FieldBaseEquator;
|
||||
//import com.engine.organization.entity.map.JclOrgMap;
|
||||
//import com.engine.organization.entity.staff.po.StaffPO;
|
||||
//import com.engine.organization.enums.ModuleTypeEnum;
|
||||
//import com.engine.organization.mapper.jclorgmap.JclOrgMapper;
|
||||
//import com.engine.organization.mapper.job.JobMapper;
|
||||
//import com.engine.organization.mapper.staff.StaffMapper;
|
||||
//import com.engine.organization.mapper.trigger.CompTriggerMapper;
|
||||
//import com.engine.organization.mapper.trigger.JobTriggerMapper;
|
||||
//import com.engine.organization.util.OrganizationDateUtil;
|
||||
//import com.engine.organization.util.db.MapperProxyFactory;
|
||||
//import org.apache.commons.collections.CollectionUtils;
|
||||
//import weaver.common.DateUtil;
|
||||
//
|
||||
//import java.sql.Date;
|
||||
//import java.util.Calendar;
|
||||
//import java.util.List;
|
||||
//
|
||||
///**
|
||||
// * @author:dxfeng
|
||||
// * @createTime: 2022/08/30
|
||||
// * @version: 1.0
|
||||
// */
|
||||
//public class JobTriggerRunnable implements Runnable {
|
||||
//
|
||||
// private final JobPO oldJob;
|
||||
// private final JobPO newJob;
|
||||
// private Boolean forbiddenTag = false;
|
||||
//
|
||||
// private CompTriggerMapper getCompTriggerMapper() {
|
||||
// return MapperProxyFactory.getProxy(CompTriggerMapper.class);
|
||||
// }
|
||||
//
|
||||
// private JobTriggerMapper getJobTriggerMapper() {
|
||||
// return MapperProxyFactory.getProxy(JobTriggerMapper.class);
|
||||
// }
|
||||
//
|
||||
// public JobTriggerRunnable(JobPO oldJob, JobPO newJob) {
|
||||
// this.oldJob = oldJob;
|
||||
// this.newJob = newJob;
|
||||
// }
|
||||
//
|
||||
// public JobTriggerRunnable(Boolean forbiddenTag, JobPO oldJob, JobPO newJob) {
|
||||
// this.oldJob = oldJob;
|
||||
// this.newJob = newJob;
|
||||
// this.forbiddenTag = forbiddenTag;
|
||||
// }
|
||||
//
|
||||
// public JobTriggerRunnable(Long jobId) {
|
||||
// this.oldJob = new JobPO();
|
||||
// this.newJob = MapperProxyFactory.getProxy(JobMapper.class).getJobById(jobId);
|
||||
// }
|
||||
//
|
||||
// public JobTriggerRunnable(Long oldJobId, Long newJobId) {
|
||||
// this.oldJob = MapperProxyFactory.getProxy(JobMapper.class).getJobById(oldJobId);
|
||||
// this.newJob = MapperProxyFactory.getProxy(JobMapper.class).getJobById(newJobId);
|
||||
// }
|
||||
//
|
||||
// public JobTriggerRunnable(JobPO newJob) {
|
||||
// this.oldJob = new JobPO();
|
||||
// this.newJob = newJob;
|
||||
// this.newJob.setDeleteType(1);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void run() {
|
||||
// FieldBaseEquator fieldBaseEquator = new FieldBaseEquator();
|
||||
// List<String> diffFields = fieldBaseEquator.getDiffFieldList(oldJob, newJob);
|
||||
// if (CollectionUtils.isEmpty(diffFields)) {
|
||||
// return;
|
||||
// }
|
||||
// // 判断
|
||||
// JclOrgMap jclMap = new JclOrgMap();
|
||||
// int st = 100000000;
|
||||
// int sj = 200000000;
|
||||
// jclMap.setFType(3);
|
||||
// // 更新逻辑
|
||||
// jclMap.setFObjId(newJob.getId().intValue());
|
||||
// jclMap.setId(newJob.getId().intValue() + sj);
|
||||
// jclMap.setFNumber(newJob.getJobNo());
|
||||
// jclMap.setFName(newJob.getJobName());
|
||||
// jclMap.setFParentId(null == newJob.getParentJob() ? newJob.getParentDept().intValue() + st : newJob.getParentJob().intValue() + sj);
|
||||
// jclMap.setFObjParentId(null == newJob.getParentJob() ? newJob.getParentDept().intValue() : newJob.getParentJob().intValue());
|
||||
// Integer parentdept = newJob.getParentDept().intValue();
|
||||
//
|
||||
// jclMap.setFClass(0);
|
||||
// jclMap.setFClassName("行政维度");
|
||||
//
|
||||
// String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date());
|
||||
// jclMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
|
||||
// jclMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
|
||||
//
|
||||
// JclOrgMap jclOrgMapByObjID = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapByObjID(jclMap.getFDateBegin(), ModuleTypeEnum.jobfielddefined.getValue().toString(), jclMap.getFObjId().toString());
|
||||
//
|
||||
// // 该岗位有下级岗位时,查询
|
||||
// JclOrgMap jclOrgMap = MapperProxyFactory.getProxy(JclOrgMapper.class).getSumPlanAndJobByFParentId(jclMap.getFDateBegin(), jclMap.getId().toString());
|
||||
//
|
||||
// StaffPO staffPO = new StaffPO();
|
||||
// switch (jclMap.getFType()) {
|
||||
// // 部门
|
||||
// case 2:
|
||||
// staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(2, null, jclMap.getFObjId().toString(), null);
|
||||
// break;
|
||||
// // 岗位
|
||||
// case 3:
|
||||
// staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(3, null, null, jclMap.getFObjId().toString());
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
// if (null != jclOrgMapByObjID) {
|
||||
// if (null != jclOrgMap) {
|
||||
// jclMap.setFPlan((null != staffPO ? staffPO.getStaffNum() : 0) + jclOrgMap.getFPlan());
|
||||
// jclMap.setFOnJob(jclOrgMapByObjID.getFOnJob() + jclOrgMap.getFOnJob());
|
||||
// } else {
|
||||
// jclMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
|
||||
// jclMap.setFOnJob(jclOrgMapByObjID.getFOnJob());
|
||||
// }
|
||||
// } else {
|
||||
// jclMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
|
||||
// jclMap.setFOnJob(0);
|
||||
// }
|
||||
// jclMap.setFIsVitual(0);
|
||||
//
|
||||
// Calendar cal = Calendar.getInstance();
|
||||
// cal.setTime(jclMap.getFDateBegin());
|
||||
// Calendar calendar = DateUtil.addDay(cal, -1);
|
||||
// Date time = new Date(calendar.getTime().getTime());
|
||||
// getCompTriggerMapper().deleteMap(jclMap.getFType(), jclMap.getFObjId(), jclMap.getFDateBegin());
|
||||
// getCompTriggerMapper().updateMap(jclMap.getFType(), jclMap.getFObjId(), jclMap.getFDateBegin(), time);
|
||||
//
|
||||
// if (1 != newJob.getDeleteType() && 1 != newJob.getForbiddenTag()) {
|
||||
// MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(jclMap);
|
||||
// }
|
||||
// if (null != jclOrgMapByObjID) {
|
||||
// if (null != jclOrgMapByObjID.getFParentId()) {
|
||||
// updateParentPlanAndJob(jclMap.getFDateBegin(), jclOrgMapByObjID.getFParentId().toString());
|
||||
// }
|
||||
// }
|
||||
// // 部门启用,刷新上级数据
|
||||
// if (forbiddenTag) {
|
||||
// updateParentPlanAndJob(jclMap.getFDateBegin(), jclMap.getFParentId().toString());
|
||||
// }
|
||||
// if (null != oldJob) {
|
||||
// if (null != oldJob.getId()) {
|
||||
// updateParentPlanAndJob(jclMap.getFDateBegin(), oldJob.getId().toString());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 更新上级部门在编、在岗数
|
||||
// */
|
||||
// void updateParentPlanAndJob(Date currentDate, String parentId) {
|
||||
// JclOrgMap parentJclOrgMap = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapById(currentDate, parentId);
|
||||
// if (null != parentJclOrgMap) {
|
||||
// // 上级部门当前在编、在岗数
|
||||
// JclOrgMap jclOrgMapSum = MapperProxyFactory.getProxy(JclOrgMapper.class).getSumPlanAndJobByFParentId(currentDate, parentJclOrgMap.getId().toString());
|
||||
// StaffPO staffPO = new StaffPO();
|
||||
// switch (parentJclOrgMap.getFType()) {
|
||||
// // 分部
|
||||
// case 1:
|
||||
// staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(1, parentJclOrgMap.getFObjId().toString(), null, null);
|
||||
// break;
|
||||
// // 部门
|
||||
// case 2:
|
||||
// staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(2, null, parentJclOrgMap.getFObjId().toString(), null);
|
||||
// break;
|
||||
// // 岗位
|
||||
// case 3:
|
||||
// staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(3, null, parentJclOrgMap.getFObjId().toString(), null);
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
// if (null != jclOrgMapSum) {
|
||||
// parentJclOrgMap.setFPlan((null != staffPO ? staffPO.getStaffNum() : 0) + jclOrgMapSum.getFPlan());
|
||||
// parentJclOrgMap.setFOnJob(jclOrgMapSum.getFOnJob());
|
||||
// } else {
|
||||
// parentJclOrgMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
|
||||
// parentJclOrgMap.setFOnJob(0);
|
||||
// }
|
||||
// parentJclOrgMap.setFDateBegin(currentDate);
|
||||
// parentJclOrgMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
|
||||
//
|
||||
// Calendar cal = Calendar.getInstance();
|
||||
// cal.setTime(parentJclOrgMap.getFDateBegin());
|
||||
// Calendar calendar = DateUtil.addDay(cal, -1);
|
||||
// Date time = new Date(calendar.getTime().getTime());
|
||||
// getCompTriggerMapper().deleteMap(parentJclOrgMap.getFType(), parentJclOrgMap.getFObjId(), parentJclOrgMap.getFDateBegin());
|
||||
// getCompTriggerMapper().updateMap(parentJclOrgMap.getFType(), parentJclOrgMap.getFObjId(), parentJclOrgMap.getFDateBegin(), time);
|
||||
// MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(parentJclOrgMap);
|
||||
// if (null != parentJclOrgMap.getFParentId() && -1 != parentJclOrgMap.getFParentId()) {
|
||||
// updateParentPlanAndJob(currentDate, parentJclOrgMap.getFParentId().toString());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
|
@ -1,27 +1,20 @@
|
|||
package com.engine.organization.thread;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.hrm.service.impl.HrmJobServiceImpl;
|
||||
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.enums.LogModuleNameEnum;
|
||||
import com.engine.organization.enums.OperateTypeEnum;
|
||||
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.db.MapperProxyFactory;
|
||||
import com.engine.organization.util.relation.EcHrmRelationUtil;
|
||||
import com.engine.organization.util.relation.ResourceSyncUtil;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
|
|
@ -81,9 +74,6 @@ public class OrganizationSyncEc {
|
|||
case DEPARTMENT:
|
||||
refreshDepartment();
|
||||
break;
|
||||
case JOB:
|
||||
refreshJob();
|
||||
break;
|
||||
case RESOURCE:
|
||||
refreshResource();
|
||||
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() {
|
||||
switch (operateType) {
|
||||
|
|
@ -175,173 +150,6 @@ public class OrganizationSyncEc {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增岗位
|
||||
*
|
||||
* <p>
|
||||
* 1、EC表HrmJobTitles
|
||||
* <p>
|
||||
* 2、系统中新建“聚才林”、“默认职务”(sql写入)
|
||||
* <p>
|
||||
* 3、检索岗位名称jobtitlename,如果已存在,判断是否封存,对已封存数据解封操作
|
||||
* <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) {
|
||||
JobPO jobById = getJobMapper().getJobById((long) jclJobId);
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
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.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import weaver.hrm.User;
|
||||
|
||||
|
|
@ -21,8 +21,9 @@ public class HrmResourceTransMethod {
|
|||
public static String getCompanyName(String companyId) {
|
||||
return MapperProxyFactory.getProxy(CompMapper.class).listById(Integer.parseInt(companyId)).getSubCompanyName();
|
||||
}
|
||||
|
||||
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) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.engine.organization.transmethod;
|
||||
|
||||
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.scheme.GradeMapper;
|
||||
import com.engine.organization.mapper.scheme.LevelMapper;
|
||||
|
|
@ -20,18 +21,16 @@ import java.util.stream.Collectors;
|
|||
*/
|
||||
public class JobTransMethod {
|
||||
|
||||
public static String getSpanById(String planId) {
|
||||
public static String getSpanById(String jobId) {
|
||||
JobMapper jobMapper = MapperProxyFactory.getProxy(JobMapper.class);
|
||||
List<Map<String, Object>> maps = jobMapper.listJobsByIds(DeleteParam.builder().ids(planId).build().getIds());
|
||||
String names = maps.stream().map(item -> (String) item.get("name")).collect(Collectors.joining(","));
|
||||
return names;
|
||||
List<JobPO> jobsByIds = jobMapper.getJobsByIds(DeleteParam.builder().ids(jobId).build().getIds());
|
||||
return jobsByIds.stream().map(JobPO::getJobTitleName).collect(Collectors.joining(","));
|
||||
}
|
||||
|
||||
public static String getLevelName(String levelId) {
|
||||
LevelMapper levelMapper = MapperProxyFactory.getProxy(LevelMapper.class);
|
||||
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 levelName;
|
||||
return maps.stream().map(item -> (String) item.get("name")).collect(Collectors.joining(","));
|
||||
}
|
||||
|
||||
public static String getGradeName(String gradeId) {
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ public class DetachUtil {
|
|||
*/
|
||||
public void filterJobList(List<JobPO> 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;
|
||||
|
||||
import com.engine.organization.entity.commom.RecordInfo;
|
||||
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.util.db.MapperProxyFactory;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
import weaver.general.Util;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
|
|
@ -18,22 +12,6 @@ import java.util.List;
|
|||
*/
|
||||
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() {
|
||||
return MapperProxyFactory.getProxy(JobMapper.class);
|
||||
}
|
||||
|
|
@ -43,37 +21,9 @@ public class EcHrmRelationUtil {
|
|||
if (null == jobById) {
|
||||
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) {
|
||||
checkMsg = "未找到对应岗位!";
|
||||
} else {
|
||||
param.setCompId(jobPO.getParentComp());
|
||||
param.setCompId(jobPO.getEcCompany());
|
||||
param.setEcCompany(jobPO.getEcCompany());
|
||||
param.setDeptId(jobPO.getParentDept());
|
||||
param.setDeptId(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.po.JobPO;
|
||||
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.OperateTypeEnum;
|
||||
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.impl.JobServiceImpl;
|
||||
import com.engine.organization.thread.JobTriggerRunnable;
|
||||
import com.engine.organization.util.MenuBtn;
|
||||
import com.engine.organization.util.OrganizationFormItemUtil;
|
||||
import com.engine.organization.util.OrganizationWrapper;
|
||||
|
|
@ -116,7 +113,7 @@ public class JobWrapper extends OrganizationWrapper {
|
|||
writeOperateLog(new Object() {
|
||||
}.getClass(), params.get("job_name").toString(), JSON.toJSONString(params), "新增岗位");
|
||||
// 更新组织架构图
|
||||
new Thread(new JobTriggerRunnable(jobId)).start();
|
||||
//TODO new Thread(new JobTriggerRunnable(jobId)).start();
|
||||
return jobId;
|
||||
}
|
||||
|
||||
|
|
@ -133,7 +130,7 @@ public class JobWrapper extends OrganizationWrapper {
|
|||
Long jobId = getJobService(user).updateForm(params);
|
||||
JobPO newJobById = getJobMapper().getJobById(id);
|
||||
writeOperateLog(new Object() {
|
||||
}.getClass(), jobById.getJobName(), JSON.toJSONString(params), jobById, newJobById);
|
||||
}.getClass(), jobById.getJobTitleName(), JSON.toJSONString(params), jobById, newJobById);
|
||||
// 更新组织架构图
|
||||
|
||||
return jobId;
|
||||
|
|
@ -151,7 +148,7 @@ public class JobWrapper extends OrganizationWrapper {
|
|||
int copyJobItem = getJobService(user).copyJobItem(param.getIds(), param.getDepartment());
|
||||
for (JobPO jobPO : jobPOS) {
|
||||
writeOperateLog(new Object() {
|
||||
}.getClass(), jobPO.getJobName(), JSON.toJSONString(param), "复制岗位[" + jobPO.getJobName() + "]");
|
||||
}.getClass(), jobPO.getJobTitleName(), JSON.toJSONString(param), "复制岗位[" + jobPO.getJobTitleName() + "]");
|
||||
}
|
||||
return copyJobItem;
|
||||
}
|
||||
|
|
@ -171,7 +168,7 @@ public class JobWrapper extends OrganizationWrapper {
|
|||
}.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;
|
||||
}
|
||||
|
||||
|
|
@ -187,9 +184,9 @@ public class JobWrapper extends OrganizationWrapper {
|
|||
int deleteByIds = getJobService(user).deleteByIds(ids);
|
||||
for (JobPO jobPO : jobPOS) {
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue