Merge remote-tracking branch 'origin/develop' into feature/ml
This commit is contained in:
commit
1bdc7e2fa4
|
|
@ -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.getDeptPrincipal()))
|
||||
.bmfzr(getEmployeeNameById(e.getId()))
|
||||
.showOrder(null == e.getShowOrder() ? 0 : e.getShowOrder())
|
||||
.canceled(null == e.getCanceled() ? 0 : e.getCanceled())
|
||||
.build()).collect(Collectors.toList());
|
||||
|
|
@ -82,6 +83,7 @@ public class DepartmentBO {
|
|||
return DepartmentPO
|
||||
.builder()
|
||||
.id(param.getId() == null ? 0 : param.getId())
|
||||
.departmentId(param.getDepartmentId())
|
||||
.departmentMark(param.getDepartmentMark())
|
||||
.departmentName(param.getDepartmentName())
|
||||
.subCompanyId1(param.getSubCompanyId1())
|
||||
|
|
@ -114,11 +116,11 @@ public class DepartmentBO {
|
|||
.departmentMark(e.getDepartmentMark())
|
||||
.subCompanyId1(e.getSubCompanyId1())
|
||||
.supDepId(e.getSupDepId())
|
||||
.supDepName(e.getSupDepId() == 0 ? "" : getDeptNameById(e.getSupDepId()))
|
||||
.supDepName(null == e.getSupDepId() || e.getSupDepId() == 0 ? "" : getDeptNameById(e.getSupDepId()))
|
||||
//.deptPrincipalName(getEmployeeNameById(e.getDeptPrincipal()))
|
||||
.build()).collect(Collectors.toList());
|
||||
//获取非一级部门
|
||||
Map<Integer, List<SingleDeptTreeVO>> collects = singleDeptTreeVOS.stream().filter(item -> !parentComp.equals(item.getSubCompanyId1()) && 0 != item.getSupDepId()).collect(Collectors.groupingBy(SingleDeptTreeVO::getSupDepId));
|
||||
Map<Integer, List<SingleDeptTreeVO>> collects = singleDeptTreeVOS.stream().filter(item -> !parentComp.equals(item.getSubCompanyId1()) && null != item.getSupDepId() && 0 != item.getSupDepId()).collect(Collectors.groupingBy(SingleDeptTreeVO::getSupDepId));
|
||||
|
||||
return singleDeptTreeVOS.stream().peek(e -> e.setChildren(collects.get(e.getId()))).filter(item -> parentComp.equals(item.getSubCompanyId1())).collect(Collectors.toList());
|
||||
}
|
||||
|
|
@ -152,8 +154,15 @@ public class DepartmentBO {
|
|||
return MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptNameById(id);
|
||||
}
|
||||
|
||||
public static String getEmployeeNameById(Long id) {
|
||||
return MapperProxyFactory.getProxy(EmployeeMapper.class).getEmployeeNameById(id);
|
||||
public static String getEmployeeNameById(Integer id) {
|
||||
if (null == id) {
|
||||
return "";
|
||||
}
|
||||
String departmentPrincipal = MapperProxyFactory.getProxy(DepartmentMapper.class).getDepartmentPrincipal(id);
|
||||
if (StringUtils.isBlank(departmentPrincipal)) {
|
||||
return "";
|
||||
}
|
||||
return MapperProxyFactory.getProxy(EmployeeMapper.class).getEmployeeNameById(Long.parseLong(departmentPrincipal));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -63,11 +63,11 @@ public class DepartmentListDTO {
|
|||
|
||||
private Integer supDepId;
|
||||
|
||||
///**
|
||||
// * 部门负责人
|
||||
// */
|
||||
//@TableTitle(title = "部门负责人", dataIndex = "deptPrincipal", key = "deptPrincipal")
|
||||
//private String deptPrincipal;
|
||||
/**
|
||||
* 部门负责人
|
||||
*/
|
||||
@TableTitle(title = "部门负责人", dataIndex = "bmfzr", key = "bmfzr")
|
||||
private String bmfzr;
|
||||
|
||||
/**
|
||||
* 显示顺序
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ public class DeptSearchParam extends BaseQueryParam {
|
|||
private Boolean canceled;
|
||||
private String departmentCode;
|
||||
private Integer coadjutant;
|
||||
private String departmentId;
|
||||
|
||||
private String uuid;
|
||||
private Double showOrder;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ public class DepartmentPO {
|
|||
private Integer canceled;
|
||||
private String departmentCode;
|
||||
private Integer coadjutant;
|
||||
private String departmentId;
|
||||
|
||||
private Date created;
|
||||
private Integer creater;
|
||||
|
|
|
|||
|
|
@ -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,4 +96,6 @@ public interface DepartmentMapper {
|
|||
|
||||
String getIdByDepartmentCode(@Param("departmentCode") String departmentCode);
|
||||
|
||||
String getDepartmentPrincipal(@Param("deptId") Integer deptId);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,6 +59,10 @@
|
|||
<if test=" departmentPO.supDepId != null ">
|
||||
and t.supDepId = #{departmentPO.supDepId}
|
||||
</if>
|
||||
<if test=" departmentPO.departmentId != null ">
|
||||
and t.id = #{departmentPO.departmentId}
|
||||
</if>
|
||||
<include refid="isCanceled"/>
|
||||
order by ${orderSql}
|
||||
</select>
|
||||
|
||||
|
|
@ -144,6 +148,11 @@
|
|||
from hrmdepartment
|
||||
where departmentcode = #{departmentCode}
|
||||
</select>
|
||||
<select id="getDepartmentPrincipal" resultType="java.lang.String">
|
||||
select bmfzr
|
||||
from hrmdepartmentdefined
|
||||
where deptid = #{deptId}
|
||||
</select>
|
||||
|
||||
<sql id="likeSQL">
|
||||
<if test=" departmentPO.departmentCode != null and departmentPO.departmentCode != '' ">
|
||||
|
|
@ -172,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}+'%'
|
||||
|
|
|
|||
|
|
@ -321,7 +321,9 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
}
|
||||
|
||||
groupList.add(new SearchConditionGroup(SystemEnv.getHtmlLabelNames(groupLabel, user.getLanguage()), true, itemList));
|
||||
groupList.add(new SearchConditionGroup("拓展信息", true, extendItemList));
|
||||
if (CollectionUtils.isNotEmpty(extendItemList)) {
|
||||
groupList.add(new SearchConditionGroup("拓展信息", true, extendItemList));
|
||||
}
|
||||
}
|
||||
}
|
||||
HashMap<String, Object> buttonsMap = new HashMap<>();
|
||||
|
|
@ -542,7 +544,9 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
}
|
||||
}
|
||||
groupList.add(new SearchConditionGroup(SystemEnv.getHtmlLabelNames(groupLabel, user.getLanguage()), true, itemList));
|
||||
groupList.add(new SearchConditionGroup("拓展信息", true, extendItemList));
|
||||
if (CollectionUtils.isNotEmpty(extendItemList)) {
|
||||
groupList.add(new SearchConditionGroup("拓展信息", true, extendItemList));
|
||||
}
|
||||
}
|
||||
return groupList;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -231,7 +230,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
|
||||
@Override
|
||||
public Map<String, List<MenuBtn>> getHasRight() {
|
||||
return MenuBtn.getDatasHasCopy();
|
||||
return MenuBtn.getDatasNoBtnColum();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -367,7 +366,9 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
itemList.add(searchConditionItem);
|
||||
}
|
||||
groupList.add(new SearchConditionGroup(SystemEnv.getHtmlLabelNames(groupLabel, user.getLanguage()), true, itemList));
|
||||
groupList.add(new SearchConditionGroup("拓展信息", true, extendItemList));
|
||||
if (CollectionUtils.isNotEmpty(extendItemList)) {
|
||||
groupList.add(new SearchConditionGroup("拓展信息", true, extendItemList));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -407,16 +408,10 @@ 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);
|
||||
SearchConditionItem copySubJob = OrganizationFormItemUtil.selectItem(user, Lists.newArrayList(new SearchConditionOption("1", "")), 2, 5, 10, false, "复制子部门岗位信息", "copySubJob");
|
||||
copySubJob.setDetailtype(2);
|
||||
condition.add(compBrowserItem);
|
||||
condition.add(isCheckItem);
|
||||
condition.add(copySubDeptItem);
|
||||
condition.add(copySubJob);
|
||||
addGroups.add(new SearchConditionGroup("", true, condition));
|
||||
return addGroups;
|
||||
}
|
||||
|
|
@ -465,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)) {
|
||||
|
|
@ -544,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());
|
||||
|
|
@ -693,7 +688,8 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
return !(StringUtil.isEmpty(departmentPO.getDepartmentCode())
|
||||
&& StringUtil.isEmpty(departmentPO.getDepartmentName())
|
||||
&& null == departmentPO.getSubCompanyId1()
|
||||
&& null == departmentPO.getSupDepId());
|
||||
&& null == departmentPO.getSupDepId()
|
||||
&& null == departmentPO.getDepartmentId());
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -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) {
|
||||
|
|
@ -880,32 +834,14 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
|
||||
String id = Util.null2String(params.get("id"));
|
||||
int viewAttr = Util.getIntValue(Util.null2String(params.get("viewattr")), 1);
|
||||
String nodeType = Util.null2String(params.get("type"));
|
||||
String addType = Util.null2String(params.get("addType"));
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
String subcompanyid1 = "";
|
||||
String supDepId = "";
|
||||
|
||||
switch (addType) {
|
||||
case "normal":
|
||||
if ("subcompany".equals(nodeType)) {
|
||||
subcompanyid1 = id;
|
||||
} else {
|
||||
subcompanyid1 = departmentComInfo.getSubcompanyid1(id);
|
||||
}
|
||||
break;
|
||||
case "sibling":
|
||||
subcompanyid1 = departmentComInfo.getSubcompanyid1(id);
|
||||
supDepId = departmentComInfo.getDepartmentsupdepid(id);
|
||||
break;
|
||||
case "child":
|
||||
subcompanyid1 = departmentComInfo.getSubcompanyid1(id);
|
||||
supDepId = id;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
String subcompanyid1 = Util.null2String(params.get("subcompanyid1"));
|
||||
String supDepId = Util.null2String(params.get("departmentid"));
|
||||
if (StringUtils.isNotBlank(supDepId)) {
|
||||
subcompanyid1 = new DepartmentComInfo().getSubcompanyid1(supDepId);
|
||||
}
|
||||
|
||||
|
||||
HrmFieldGroupComInfo HrmFieldGroupComInfo = new HrmFieldGroupComInfo();
|
||||
HrmFieldComInfo HrmFieldComInfo = new HrmFieldComInfo();
|
||||
HrmFieldSearchConditionComInfo hrmFieldSearchConditionComInfo = new HrmFieldSearchConditionComInfo();
|
||||
|
|
@ -1018,7 +954,9 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
}
|
||||
}
|
||||
groupList.add(new SearchConditionGroup(SystemEnv.getHtmlLabelNames(grouplabel, user.getLanguage()), true, itemList));
|
||||
groupList.add(new SearchConditionGroup("拓展信息", true, extendItemList));
|
||||
if (CollectionUtils.isNotEmpty(extendItemList)) {
|
||||
groupList.add(new SearchConditionGroup("拓展信息", true, extendItemList));
|
||||
}
|
||||
}
|
||||
return groupList;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,8 +66,7 @@ public class HrmPersonnelCardServiceImpl extends Service implements HrmPersonnel
|
|||
|
||||
// 获取类型分组信息
|
||||
List<CusTreeFormPO> cusTreeForms = getPersonnelCardMapper().getCusTreeForms(0);
|
||||
// TODO 权限过滤
|
||||
//cusTreeForms.removeIf(item -> !hasGroupAccess(item.getId(), userInfo.getEcId()));
|
||||
cusTreeForms.removeIf(item -> !hasGroupAccess(item.getId(), userInfo.getEcId()));
|
||||
List<FormItem> formItemList = new ArrayList<>();
|
||||
try {
|
||||
for (CusTreeFormPO cusTreeForm : cusTreeForms) {
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
// 等级方案、岗位序列、职等、职级
|
||||
|
|
|
|||
|
|
@ -7,37 +7,24 @@ import com.api.browser.util.ConditionType;
|
|||
import com.cloudstore.eccom.result.WeaResultMsg;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.organization.component.OrganizationWeaTable;
|
||||
import com.engine.organization.entity.commom.RecordInfo;
|
||||
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;
|
||||
import com.engine.organization.entity.jclimport.vo.JclImportHistoryDetailVO;
|
||||
import com.engine.organization.entity.job.po.JobPO;
|
||||
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.HrmResourceTriggerRunnable;
|
||||
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;
|
||||
|
|
@ -45,6 +32,7 @@ import com.engine.organization.util.excel.ExcelUtil;
|
|||
import com.engine.organization.util.saveimport.CompanyImport;
|
||||
import com.engine.organization.util.saveimport.DepartmentImport;
|
||||
import com.engine.organization.util.saveimport.OrgImportUtil;
|
||||
import com.engine.organization.util.saveimport.ResourceImport;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
|
||||
|
|
@ -111,8 +99,6 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
String tableName = "";
|
||||
String errorMsg = "";
|
||||
List<String> excludeFields = new ArrayList<>();
|
||||
//List<FieldTransferParam> includeFields = new ArrayList<>();
|
||||
//List<String> selectedList = new ArrayList<>();
|
||||
Map<String, Object> returnMaps = new HashMap<>();
|
||||
if (StringUtils.isNotBlank(importType)) {
|
||||
switch (importType) {
|
||||
|
|
@ -128,18 +114,14 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
excludeFields.add("showid");
|
||||
return DepartmentImport.getImportFields(user, excludeFields);
|
||||
case "jobtitle":
|
||||
extendType = "3";
|
||||
tableName = "JCL_ORG_JOB";
|
||||
excludeFields.add("parent_job");
|
||||
break;
|
||||
case "resource":
|
||||
extendType = "4";
|
||||
tableName = "JCL_ORG_HRMRESOURCE";
|
||||
excludeFields.add("scheme_id");
|
||||
excludeFields.add("sequence_id");
|
||||
excludeFields.add("job_grade");
|
||||
excludeFields.add("job_level");
|
||||
break;
|
||||
excludeFields.add("resourceimageid");
|
||||
excludeFields.add("messagerurl");
|
||||
excludeFields.add("workyear");
|
||||
excludeFields.add("companyworkyear");
|
||||
excludeFields.add("textfield1");
|
||||
excludeFields.add("textfield2");
|
||||
return ResourceImport.getImportFields(user, excludeFields);
|
||||
case "joblevel":
|
||||
extendType = "0";
|
||||
tableName = "JCL_ORG_SCHEME";
|
||||
|
|
@ -201,10 +183,10 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
returnMap.put("condition", DepartmentImport.importForm(user, templatePath));
|
||||
break;
|
||||
case "jobtitle":
|
||||
returnMap.put("condition", getJobTitleImportForm(templatePath));
|
||||
break;
|
||||
//returnMap.put("condition", getJobTitleImportForm(templatePath));
|
||||
//break;
|
||||
case "resource":
|
||||
returnMap.put("condition", getResourceImportForm(templatePath));
|
||||
returnMap.put("condition", ResourceImport.importForm(user, templatePath));
|
||||
break;
|
||||
case "joblevel":
|
||||
returnMap.put("condition", getJobLevelImportForm(templatePath));
|
||||
|
|
@ -240,10 +222,8 @@ 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", hrmResourceImport(operateType, excelFile, keyField));
|
||||
returnMap.put("pId", ResourceImport.saveImport(operateType, excelFile, user, request));
|
||||
break;
|
||||
case "joblevel":
|
||||
returnMap.put("pId", jobLevelImport(operateType, excelFile));
|
||||
|
|
@ -299,65 +279,6 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
return returnMap;
|
||||
}
|
||||
|
||||
|
||||
private List<Object> getJobTitleImportForm(String templatePath) throws IOException {
|
||||
|
||||
// 返回导入数据
|
||||
List<Object> lsGroup = new ArrayList<>();
|
||||
Map<String, Object> groupItem = new HashMap<>();
|
||||
List<Object> itemList = new ArrayList<>();
|
||||
|
||||
groupItem.put("title", SystemEnv.getHtmlLabelName(1361, user.getLanguage()));
|
||||
groupItem.put("defaultshow", true);
|
||||
|
||||
SearchConditionItem searchConditionItem;
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
|
||||
//导入类型
|
||||
List<SearchConditionOption> statusOptions = new ArrayList<>();
|
||||
statusOptions.add(new SearchConditionOption("add", SystemEnv.getHtmlLabelName(611, user.getLanguage()), true));
|
||||
statusOptions.add(new SearchConditionOption("update", SystemEnv.getHtmlLabelName(17744, user.getLanguage())));
|
||||
searchConditionItem = conditionFactory.createCondition(ConditionType.SELECT, 24863, "importType", statusOptions);
|
||||
searchConditionItem.setValue("add");
|
||||
itemList.add(searchConditionItem);
|
||||
|
||||
//模板文件
|
||||
searchConditionItem = conditionFactory.createCondition(ConditionType.INPUT, 28576, "templet");
|
||||
searchConditionItem.setValue(templatePath);
|
||||
itemList.add(searchConditionItem);
|
||||
|
||||
//Excel文件
|
||||
searchConditionItem = conditionFactory.createCondition(ConditionType.RESOURCEIMG, 16630, "excelfile");
|
||||
itemList.add(searchConditionItem);
|
||||
|
||||
groupItem.put("items", itemList);
|
||||
lsGroup.add(groupItem);
|
||||
|
||||
|
||||
itemList = new ArrayList<>();
|
||||
groupItem = new HashMap<>();
|
||||
groupItem.put("title", SystemEnv.getHtmlLabelName(33803, Util.getIntValue(user.getLanguage())));
|
||||
groupItem.put("defaultshow", true);
|
||||
List<Integer> lsPromptLabel = new ArrayList<>(); //提示信息
|
||||
lsPromptLabel.add(34275);
|
||||
lsPromptLabel.add(125452);
|
||||
|
||||
for (int i = 0; i < lsPromptLabel.size(); i++) {
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
item.put("index", (i + 1));
|
||||
String value = Util.toScreen(SystemEnv.getHtmlLabelName(lsPromptLabel.get(i), user.getLanguage()), user.getLanguage());
|
||||
if (i == 0) {
|
||||
value += SystemEnv.getHtmlLabelName(28576, user.getLanguage());
|
||||
item.put("link", templatePath);
|
||||
}
|
||||
item.put("value", value);
|
||||
itemList.add(item);
|
||||
}
|
||||
groupItem.put("items", itemList);
|
||||
lsGroup.add(groupItem);
|
||||
return lsGroup;
|
||||
}
|
||||
|
||||
private List<Object> getJobLevelImportForm(String templatePath) throws IOException {
|
||||
|
||||
// 返回导入数据
|
||||
|
|
@ -420,614 +341,6 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
return lsGroup;
|
||||
}
|
||||
|
||||
private List<Object> getResourceImportForm(String templatePath) throws IOException {
|
||||
|
||||
// 返回导入数据
|
||||
List<Object> lsGroup = new ArrayList<>();
|
||||
Map<String, Object> groupItem = new HashMap<>();
|
||||
List<Object> itemList = new ArrayList<>();
|
||||
|
||||
groupItem.put("title", SystemEnv.getHtmlLabelName(1361, user.getLanguage()));
|
||||
groupItem.put("defaultshow", true);
|
||||
|
||||
SearchConditionItem searchConditionItem;
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
|
||||
//重复验证字段
|
||||
List<SearchConditionOption> statusOptions = new ArrayList<>();
|
||||
statusOptions.add(new SearchConditionOption("last_name", SystemEnv.getHtmlLabelName(413, user.getLanguage())));
|
||||
statusOptions.add(new SearchConditionOption("work_code", SystemEnv.getHtmlLabelName(714, user.getLanguage()), true));
|
||||
//statusOptions.add(new SearchConditionOption("loginid", SystemEnv.getHtmlLabelName(412, user.getLanguage())));
|
||||
searchConditionItem = conditionFactory.createCondition(ConditionType.SELECT, 24638, "keyField", statusOptions);
|
||||
searchConditionItem.setValue("last_name");
|
||||
itemList.add(searchConditionItem);
|
||||
|
||||
//导入类型
|
||||
List<SearchConditionOption> statusOptions1 = new ArrayList<>();
|
||||
statusOptions1.add(new SearchConditionOption("add", SystemEnv.getHtmlLabelName(611, user.getLanguage()), true));
|
||||
statusOptions1.add(new SearchConditionOption("update", SystemEnv.getHtmlLabelName(17744, user.getLanguage())));
|
||||
searchConditionItem = conditionFactory.createCondition(ConditionType.SELECT, 24863, "importType", statusOptions1);
|
||||
searchConditionItem.setValue("add");
|
||||
itemList.add(searchConditionItem);
|
||||
|
||||
//模板文件
|
||||
searchConditionItem = conditionFactory.createCondition(ConditionType.INPUT, 28576, "templet");
|
||||
searchConditionItem.setValue(templatePath);
|
||||
itemList.add(searchConditionItem);
|
||||
|
||||
//Excel文件
|
||||
searchConditionItem = conditionFactory.createCondition(ConditionType.RESOURCEIMG, 16630, "excelfile");
|
||||
itemList.add(searchConditionItem);
|
||||
|
||||
groupItem.put("items", itemList);
|
||||
lsGroup.add(groupItem);
|
||||
|
||||
|
||||
itemList = new ArrayList<>();
|
||||
groupItem = new HashMap<>();
|
||||
groupItem.put("title", SystemEnv.getHtmlLabelName(33803, Util.getIntValue(user.getLanguage())));
|
||||
groupItem.put("defaultshow", true);
|
||||
List<Integer> lsPromptLabel = new ArrayList<>(); //提示信息
|
||||
lsPromptLabel.add(128520);
|
||||
lsPromptLabel.add(125868);
|
||||
lsPromptLabel.add(128365);
|
||||
//lsPromptLabel.add(81697);
|
||||
//lsPromptLabel.add(81698);
|
||||
lsPromptLabel.add(81699);
|
||||
lsPromptLabel.add(516263);
|
||||
//lsPromptLabel.add(81701);
|
||||
//lsPromptLabel.add(388880);
|
||||
lsPromptLabel.add(81702);
|
||||
lsPromptLabel.add(81703);
|
||||
lsPromptLabel.add(125869);
|
||||
|
||||
for (int i = 0; i < lsPromptLabel.size(); i++) {
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
item.put("index", (i + 1));
|
||||
String value = Util.toScreen(SystemEnv.getHtmlLabelName(lsPromptLabel.get(i), user.getLanguage()), user.getLanguage());
|
||||
if (i == 0) {
|
||||
value += SystemEnv.getHtmlLabelName(28576, user.getLanguage());
|
||||
item.put("link", templatePath);
|
||||
}
|
||||
item.put("value", value);
|
||||
itemList.add(item);
|
||||
}
|
||||
groupItem.put("items", itemList);
|
||||
lsGroup.add(groupItem);
|
||||
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;
|
||||
}
|
||||
|
||||
private Long hrmResourceImport(String operateType, String excelFile, String keyField) {
|
||||
Long importHistoryId = OrgImportUtil.saveImportLog("resource", 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;
|
||||
|
||||
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(RESOURCE_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) && !"work_code".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()) && !"job_title".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_title".equals(infoPO.getFieldName())) {
|
||||
if (null == parentCompanyId) {
|
||||
historyDetailPO.setOperateDetail(cellValue + "所属分部未找到");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
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) {
|
||||
parentJobId = MapperProxyFactory.getProxy(JobMapper.class).getIdByNameAndPid(s, parentCompanyId, parentDepartmentId == null ? 0 : parentDepartmentId, parentJobId == null ? 0 : parentJobId);
|
||||
if (null == parentJobId) {
|
||||
historyDetailPO.setOperateDetail(s + "岗位未找到对应数据");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
}
|
||||
}
|
||||
map.put("company_id", parentCompanyId);
|
||||
map.put("department_id", parentDepartmentId);
|
||||
map.put("ec_company", parentCompanyId);
|
||||
map.put("ec_department", parentDepartmentId);
|
||||
|
||||
map.put("job_title", parentJobId);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 校验、数据交互
|
||||
if (i == 0) {
|
||||
continue;
|
||||
}
|
||||
// 根据岗位获取等级方案、岗位序列、职等、职级
|
||||
if (null != parentJobId) {
|
||||
JobPO jobById = MapperProxyFactory.getProxy(JobMapper.class).getJobById(parentJobId);
|
||||
map.put("scheme_id", jobById.getSchemeId());
|
||||
map.put("sequence_id", jobById.getSequenceId());
|
||||
map.put("job_level", jobById.getLevelId());
|
||||
map.put("job_grade", jobById.getGradeId());
|
||||
}
|
||||
|
||||
String keyFieldValue = Util.null2String(map.get(keyField));
|
||||
if (StringUtils.isBlank(keyFieldValue)) {
|
||||
historyDetailPO.setOperateDetail("所选重复验证字段为空");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue;
|
||||
}
|
||||
historyDetailPO.setRelatedName(keyFieldValue);
|
||||
// 判断当前人员是否存在
|
||||
boolean hasSameKeyFieldValue = hasSameKeyFieldValue(historyDetailPO, keyField, keyFieldValue);
|
||||
if (hasSameKeyFieldValue) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Long resourceId = MapperProxyFactory.getProxy(ResourceMapper.class).getIdByKeyField(keyField, keyFieldValue).get(0);
|
||||
if ("add".equals(operateType)) {
|
||||
if (resourceId != null) {
|
||||
historyDetailPO.setOperateDetail(keyFieldValue + "已存在");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 自动编号
|
||||
String workCode = Util.null2String(map.get("work_code"));
|
||||
try {
|
||||
// 自动编号
|
||||
try {
|
||||
workCode = HrmResourceServiceImpl.repeatDetermine(workCode);
|
||||
} catch (OrganizationRunTimeException e) {
|
||||
historyDetailPO.setOperateDetail(e.getMessage());
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue;
|
||||
}
|
||||
map.put("work_code", workCode);
|
||||
} catch (Exception e) {
|
||||
historyDetailPO.setOperateDetail(Util.null2String(e.getMessage()));
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
}
|
||||
map.put("creator", user.getUID());
|
||||
map.put("delete_type", 0);
|
||||
map.put("create_time", new Date());
|
||||
|
||||
String showOrder = Util.null2String(map.get("show_order"));
|
||||
if (StringUtils.isBlank(showOrder)) {
|
||||
Long maxShowOrder = MapperProxyFactory.getProxy(ResourceMapper.class).getMaxShowOrder();
|
||||
if (null == maxShowOrder) {
|
||||
maxShowOrder = 0L;
|
||||
}
|
||||
map.put("show_order", maxShowOrder + 1);
|
||||
}
|
||||
Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.RESOURCE, OperateTypeEnum.ADD, map, false).sync();
|
||||
if (OrgImportUtil.isThrowError(syncMap) && StringUtils.isNotBlank(Util.null2String(syncMap.get("id")))) {
|
||||
String ecResourceId = Util.null2String(syncMap.get("id"));
|
||||
RecordInfo recordInfo = getSystemDataMapper().getHrmObjectByID(HRM_RESOURCE, ecResourceId);
|
||||
map.put("uuid", recordInfo.getUuid());
|
||||
ExtendInfoParams infoParams = ExtendInfoParams.builder().tableName("JCL_ORG_HRMRESOURCE").params(map).build();
|
||||
map.remove("id");
|
||||
MapperProxyFactory.getProxy(ExtMapper.class).insertTable(infoParams);
|
||||
// 更新组织架构图
|
||||
new HrmResourceTriggerRunnable(infoParams.getId()).run();
|
||||
historyDetailPO.setOperateDetail("添加成功");
|
||||
historyDetailPO.setStatus("1");
|
||||
|
||||
} else {
|
||||
historyDetailPO.setOperateDetail(Util.null2String(syncMap.get("message")));
|
||||
historyDetailPO.setStatus("0");
|
||||
}
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
} else if ("update".equals(operateType)) {
|
||||
// 查询对应ID
|
||||
if (resourceId == null) {
|
||||
historyDetailPO.setOperateDetail("未找到对应数据");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue;
|
||||
}
|
||||
map.put("update_time", new Date());
|
||||
map.put("id", resourceId);
|
||||
Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.RESOURCE, OperateTypeEnum.UPDATE, map, false).sync();
|
||||
if (OrgImportUtil.isThrowError(syncMap)) {
|
||||
map.remove("id");
|
||||
MapperProxyFactory.getProxy(ExtMapper.class).updateTable(ExtendInfoParams.builder().id(resourceId).tableName("JCL_ORG_HRMRESOURCE").params(map).build());
|
||||
// 更新组织架构图
|
||||
new HrmResourceTriggerRunnable(resourceId).run();
|
||||
historyDetailPO.setOperateDetail("更新成功");
|
||||
historyDetailPO.setStatus("1");
|
||||
|
||||
} else {
|
||||
historyDetailPO.setOperateDetail(Util.null2String(syncMap.get("message")));
|
||||
historyDetailPO.setStatus("0");
|
||||
}
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
}
|
||||
}
|
||||
return importHistoryId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 方案职等职级导入
|
||||
*/
|
||||
|
|
@ -1438,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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成导入模板文件
|
||||
|
|
@ -1472,20 +764,39 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
List<Object> gradeList = new ArrayList<>();
|
||||
Object companyColumn = "";
|
||||
Object departmentColumn = "";
|
||||
|
||||
String companyFieldName = "所属分部";
|
||||
String departmentFieldName = "所属部门";
|
||||
switch (importType) {
|
||||
case "company":
|
||||
companyFieldName = "简称";
|
||||
departmentFieldName = "";
|
||||
break;
|
||||
case "department":
|
||||
companyFieldName = "所属分部";
|
||||
departmentFieldName = "简称";
|
||||
break;
|
||||
case "resource":
|
||||
companyFieldName = "分部";
|
||||
departmentFieldName = "部门";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// 排序
|
||||
/*
|
||||
第一列:所属分部
|
||||
第二列:所属部门\上级部门\部门
|
||||
第一列:分部
|
||||
第二列:部门
|
||||
*/
|
||||
Iterator<Object> iterator = columnList.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Object column = iterator.next();
|
||||
if ("所属分部".equals(column.toString())) {
|
||||
if (companyFieldName.equals(column.toString())) {
|
||||
companyColumn = column;
|
||||
iterator.remove();
|
||||
}
|
||||
|
||||
if ("所属部门".equals(column) || "上级部门".equals(column)) {
|
||||
if (departmentFieldName.equals(column)) {
|
||||
departmentColumn = column;
|
||||
iterator.remove();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.getDatasHasCopy();
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,204 @@
|
|||
package com.engine.organization.util.saveimport;
|
||||
|
||||
import com.api.browser.bean.SearchConditionItem;
|
||||
import com.api.browser.bean.SearchConditionOption;
|
||||
import com.api.browser.util.ConditionFactory;
|
||||
import com.api.browser.util.ConditionType;
|
||||
import com.engine.organization.entity.fieldset.param.FieldTransferParam;
|
||||
import com.engine.organization.entity.jclimport.po.HrmFormFieldPO;
|
||||
import com.engine.organization.entity.jclimport.po.JclImportHistoryDetailPO;
|
||||
import com.engine.organization.entity.personnelcard.po.CusTreeFormPO;
|
||||
import com.engine.organization.exception.OrganizationRunTimeException;
|
||||
import com.engine.organization.mapper.jclimport.ImportMapper;
|
||||
import com.engine.organization.mapper.jclimport.JclImportHistoryDetailMapper;
|
||||
import com.engine.organization.mapper.personnelcard.PersonnelCardMapper;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.engine.organization.util.saveimport.hrmimport.HrmImportAdaptExcelE9;
|
||||
import com.engine.organization.util.saveimport.hrmimport.HrmImportProcessE9;
|
||||
import weaver.file.FileUploadToPath;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.definedfield.HrmFieldManager;
|
||||
import weaver.join.hrm.in.HrmResourceVo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/12/07
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class ResourceImport {
|
||||
|
||||
private static ImportMapper getImportMapper() {
|
||||
return MapperProxyFactory.getProxy(ImportMapper.class);
|
||||
}
|
||||
|
||||
private static PersonnelCardMapper getPersonnelCardMapper() {
|
||||
return MapperProxyFactory.getProxy(PersonnelCardMapper.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入模板可选择字段
|
||||
*
|
||||
* @param user 当前用户
|
||||
* @param excludedFields 排除的字段
|
||||
*/
|
||||
public static Map<String, Object> getImportFields(User user, List<String> excludedFields) {
|
||||
|
||||
try {
|
||||
List<HrmFormFieldPO> importFields = new ArrayList<>();
|
||||
List<CusTreeFormPO> cusTreeForms = getPersonnelCardMapper().getCusTreeForms(0);
|
||||
importFields.add(HrmFormFieldPO.builder().fieldName("subcompanyid1").labelName("分部").build());
|
||||
for (CusTreeFormPO cusTreeForm : cusTreeForms) {
|
||||
HrmFieldManager hfm = new HrmFieldManager("HrmCustomFieldByInfoType", cusTreeForm.getId());
|
||||
hfm.getCustomFields();
|
||||
while (hfm.next()) {
|
||||
String fieldName = hfm.getFieldname();
|
||||
String fieldLabel = SystemEnv.getHtmlLabelNames(hfm.getLable(), user.getLanguage());
|
||||
importFields.add(HrmFormFieldPO.builder().fieldName(fieldName).labelName(fieldLabel).build());
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> returnMaps = new HashMap<>();
|
||||
importFields.removeIf(item -> excludedFields.contains(item.getFieldName()));
|
||||
|
||||
// 查询所有可以勾选的字段
|
||||
List<FieldTransferParam> fieldDatas = importFields.stream().map(item -> FieldTransferParam.builder().id(item.getFieldName()).name(item.getLabelName()).build()).collect(Collectors.toList());
|
||||
returnMaps.put("data", fieldDatas);
|
||||
|
||||
|
||||
// 设置必填字段
|
||||
List<String> selectedKeys = new ArrayList<>();
|
||||
selectedKeys.add("subcompanyid1");
|
||||
selectedKeys.add("departmentid");
|
||||
selectedKeys.add("lastname");
|
||||
selectedKeys.add("jobtitle");
|
||||
selectedKeys.add("jobactivity");
|
||||
selectedKeys.add("jobGroupId");
|
||||
selectedKeys.add("locationid");
|
||||
returnMaps.put("selectedKeys", selectedKeys);
|
||||
return returnMaps;
|
||||
} catch (Exception e) {
|
||||
new BaseBean().writeLog(e);
|
||||
throw new OrganizationRunTimeException("人员导入字段生成异常");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取导入模板及导入提示信息
|
||||
*
|
||||
* @param user 当前用户
|
||||
* @param templatePath 导入模板路径
|
||||
*/
|
||||
public static List<Map<String, Object>> importForm(User user, String templatePath) {
|
||||
|
||||
// 返回导入数据
|
||||
List<Map<String, Object>> lsGroup = new ArrayList<>();
|
||||
Map<String, Object> groupItem = new HashMap<>();
|
||||
List<Object> itemList = new ArrayList<>();
|
||||
|
||||
groupItem.put("title", SystemEnv.getHtmlLabelName(1361, user.getLanguage()));
|
||||
groupItem.put("defaultshow", true);
|
||||
|
||||
SearchConditionItem searchConditionItem;
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
|
||||
//重复验证字段
|
||||
List<SearchConditionOption> statusOptions = new ArrayList<>();
|
||||
statusOptions.add(new SearchConditionOption("last_name", SystemEnv.getHtmlLabelName(413, user.getLanguage())));
|
||||
statusOptions.add(new SearchConditionOption("work_code", SystemEnv.getHtmlLabelName(714, user.getLanguage()), true));
|
||||
//statusOptions.add(new SearchConditionOption("loginid", SystemEnv.getHtmlLabelName(412, user.getLanguage())));
|
||||
searchConditionItem = conditionFactory.createCondition(ConditionType.SELECT, 24638, "keyField", statusOptions);
|
||||
searchConditionItem.setValue("last_name");
|
||||
itemList.add(searchConditionItem);
|
||||
|
||||
//导入类型
|
||||
List<SearchConditionOption> statusOptions1 = new ArrayList<>();
|
||||
statusOptions1.add(new SearchConditionOption("add", SystemEnv.getHtmlLabelName(611, user.getLanguage()), true));
|
||||
statusOptions1.add(new SearchConditionOption("update", SystemEnv.getHtmlLabelName(17744, user.getLanguage())));
|
||||
searchConditionItem = conditionFactory.createCondition(ConditionType.SELECT, 24863, "importType", statusOptions1);
|
||||
searchConditionItem.setValue("add");
|
||||
itemList.add(searchConditionItem);
|
||||
|
||||
//模板文件
|
||||
searchConditionItem = conditionFactory.createCondition(ConditionType.INPUT, 28576, "templet");
|
||||
searchConditionItem.setValue(templatePath);
|
||||
itemList.add(searchConditionItem);
|
||||
|
||||
//Excel文件
|
||||
searchConditionItem = conditionFactory.createCondition(ConditionType.RESOURCEIMG, 16630, "excelfile");
|
||||
itemList.add(searchConditionItem);
|
||||
|
||||
groupItem.put("items", itemList);
|
||||
lsGroup.add(groupItem);
|
||||
|
||||
|
||||
itemList = new ArrayList<>();
|
||||
groupItem = new HashMap<>();
|
||||
groupItem.put("title", SystemEnv.getHtmlLabelName(33803, Util.getIntValue(user.getLanguage())));
|
||||
groupItem.put("defaultshow", true);
|
||||
List<Integer> lsPromptLabel = new ArrayList<>(); //提示信息
|
||||
lsPromptLabel.add(128520);
|
||||
lsPromptLabel.add(125868);
|
||||
lsPromptLabel.add(128365);
|
||||
//lsPromptLabel.add(81697);
|
||||
//lsPromptLabel.add(81698);
|
||||
lsPromptLabel.add(81699);
|
||||
lsPromptLabel.add(516263);
|
||||
//lsPromptLabel.add(81701);
|
||||
//lsPromptLabel.add(388880);
|
||||
lsPromptLabel.add(81702);
|
||||
lsPromptLabel.add(81703);
|
||||
lsPromptLabel.add(125869);
|
||||
|
||||
for (int i = 0; i < lsPromptLabel.size(); i++) {
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
item.put("index", (i + 1));
|
||||
String value = Util.toScreen(SystemEnv.getHtmlLabelName(lsPromptLabel.get(i), user.getLanguage()), user.getLanguage());
|
||||
if (i == 0) {
|
||||
value += SystemEnv.getHtmlLabelName(28576, user.getLanguage());
|
||||
item.put("link", templatePath);
|
||||
}
|
||||
item.put("value", value);
|
||||
itemList.add(item);
|
||||
}
|
||||
groupItem.put("items", itemList);
|
||||
lsGroup.add(groupItem);
|
||||
return lsGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param operateType 导入类型
|
||||
* @param excelFile 上传的文件
|
||||
* @param user 当前用户
|
||||
*/
|
||||
public static Long saveImport(String operateType, String excelFile, User user, HttpServletRequest request) {
|
||||
Long importHistoryId = OrgImportUtil.saveImportLog("resource", operateType, user);
|
||||
HrmImportAdaptExcelE9 importAdapt = new HrmImportAdaptExcelE9();
|
||||
FileUploadToPath fu = new FileUploadToPath(request);
|
||||
|
||||
List<String> errorInfo = importAdapt.creatImportMap(fu);
|
||||
|
||||
//如果读取数据和验证模板没有发生错误
|
||||
if (errorInfo.isEmpty()) {
|
||||
Map<String, HrmResourceVo> hrMap = importAdapt.getHrmImportMap();
|
||||
HrmImportProcessE9 importProcess = new HrmImportProcessE9();
|
||||
importProcess.init(request, importHistoryId);
|
||||
importProcess.processMap(hrMap);
|
||||
} else {
|
||||
for (String s : errorInfo) {
|
||||
MapperProxyFactory.getProxy(JclImportHistoryDetailMapper.class).insertHistoryDetail(JclImportHistoryDetailPO.builder().pid(importHistoryId).operateDetail(Util.null2String(s)).status("0").build());
|
||||
}
|
||||
}
|
||||
return importHistoryId;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,9 +54,9 @@ public class HrmImportAdaptExcelE9 extends BaseBean implements IHrmImportAdapt {
|
|||
private String[] temFields;
|
||||
|
||||
//标准模板字段
|
||||
private String tempField = "所属分部,部门," +
|
||||
private String tempField = "分部,部门," +
|
||||
"编号,姓名,登录名,密码,安全级别,性别," +
|
||||
// "岗位,职务,职务类别,职称," +
|
||||
"岗位,职务,职务类别,职称,职级," +
|
||||
"职责描述,直接上级,助理,状态," +
|
||||
"办公室,办公地点,办公电话,移动电话,其他电话," +
|
||||
"传真,电子邮件,系统语言,出生日期,民族," +
|
||||
|
|
@ -72,7 +72,7 @@ public class HrmImportAdaptExcelE9 extends BaseBean implements IHrmImportAdapt {
|
|||
private String[] requiredFields;
|
||||
|
||||
//必填列标准模板或字段下标
|
||||
// 所属分部,部门,姓名,岗位,职务,职务类别,办公地点
|
||||
// 分部,部门,姓名,岗位,职务,职务类别,办公地点
|
||||
// private String requiredField = "0,1,3,8,9,10,18";
|
||||
private final StringBuilder requiredField = new StringBuilder();
|
||||
|
||||
|
|
@ -82,7 +82,7 @@ public class HrmImportAdaptExcelE9 extends BaseBean implements IHrmImportAdapt {
|
|||
//标准导入字段
|
||||
private String voField = "subcompanyid1,departmentid," +
|
||||
"workcode,lastname,loginid,password,seclevel,sex," +
|
||||
// "jobtitle,jobactivityid,jobgroupid,jobcall," +
|
||||
"jobtitle,jobactivityid,jobgroupid,jobcall,joblevel," +
|
||||
"jobactivitydesc,managerid,assistantid,status," +
|
||||
"workroom,locationid,telephone,mobile,mobilecall," +
|
||||
"fax,email,systemlanguage,birthday,folk," +
|
||||
|
|
@ -282,8 +282,7 @@ public class HrmImportAdaptExcelE9 extends BaseBean implements IHrmImportAdapt {
|
|||
cellValue = getCellValue(cell).trim();
|
||||
for (int k = 0; k < temFields.length; k++) {
|
||||
if (cellValue.equals(temFields[k])) {
|
||||
String requiredFields = "所属分部,部门,姓名,岗位,职务,职务类别,办公地点";
|
||||
requiredFields = "所属分部,部门,登录名,姓名,性别,状态,办公地点,入职日期,参加工作日期,担任岗位,职等职级,担任职务";
|
||||
String requiredFields = "分部,部门,姓名,岗位,职务,职务类别,办公地点";
|
||||
List<String> requiredFieldList = Arrays.asList(requiredFields.split(","));
|
||||
|
||||
if (requiredFieldList.contains(cellValue)) {
|
||||
|
|
@ -307,19 +306,19 @@ public class HrmImportAdaptExcelE9 extends BaseBean implements IHrmImportAdapt {
|
|||
errorInfo.add(getCellPosition(i, (rowIndex + 1)) + "[" + cellValue + "]" + " 不是模板中字段,请检查是否有误"); //不是模板中字段,请检查是否有误
|
||||
if (importType.equals("add")) { //如果是插入操作才验证固定列
|
||||
if (i == 0 && !cellValue.equals(temFields[0]))
|
||||
errorInfo.add("分所属分部部必须在第" + (rowIndex + 1) + "行第1列"); //【所属分部】固定列
|
||||
errorInfo.add("分部必须在第" + (rowIndex + 1) + "行第1列"); //【分部】固定列
|
||||
if (i == 1 && !cellValue.equals(temFields[1]))
|
||||
errorInfo.add("部门必须在第" + (rowIndex + 1) + "行第2列"); // 【部门】固定列
|
||||
} else {
|
||||
//如果是更新,并且存在分部部门列,就规定分部、部门在第1、2列
|
||||
if (cellValue.equals(temFields[0]) && !temFields[1].equals(getCellValue(rowIndex, 1).trim()))
|
||||
errorInfo.add("更新时有分所属分部部则后一列必须为部门,且第" + (rowIndex + 1) + "行第1列为分所属分部部,第2列为部门"); //【分部】固定列
|
||||
errorInfo.add("更新时有分部则后一列必须为部门,且第" + (rowIndex + 1) + "行第1列为分部,第2列为部门"); //【分部】固定列
|
||||
else if (cellValue.equals(temFields[0]) && i != 0)
|
||||
errorInfo.add("所属分部必须在第" + (rowIndex + 1) + "行第1列"); //【分部】固定列
|
||||
errorInfo.add("分部必须在第" + (rowIndex + 1) + "行第1列"); //【分部】固定列
|
||||
|
||||
|
||||
if (cellValue.equals(temFields[1]) && !temFields[0].equals(getCellValue(rowIndex, 0).trim()))
|
||||
errorInfo.add("更新时有部门则前一列必须为所属分部,且第" + (rowIndex + 1) + "行第1列为所属分部,第2列为部门"); //【分部】固定列
|
||||
errorInfo.add("更新时有部门则前一列必须为分部,且第" + (rowIndex + 1) + "行第1列为分部,第2列为部门"); //【分部】固定列
|
||||
else if (cellValue.equals(temFields[1]) && i != 1)
|
||||
errorInfo.add("部门必须在第" + (rowIndex + 1) + "行第2列"); //【部门】固定列
|
||||
|
||||
|
|
@ -432,7 +431,7 @@ public class HrmImportAdaptExcelE9 extends BaseBean implements IHrmImportAdapt {
|
|||
|
||||
if (flag) { // 为true则,设置值,否则不需要
|
||||
|
||||
if (fieldIndex == 0 && getCellValue(1, cellNum).equals("所属分部")) { // 对于excel分部为空则取上面分部读取的值
|
||||
if (fieldIndex == 0 && getCellValue(1, cellNum).equals("分部")) { // 对于excel分部为空则取上面分部读取的值
|
||||
if (cellValue.equals(""))
|
||||
cellValue = subCompany;
|
||||
else
|
||||
|
|
@ -619,7 +618,7 @@ public class HrmImportAdaptExcelE9 extends BaseBean implements IHrmImportAdapt {
|
|||
String fieldName = voFields[fieldIndex];
|
||||
|
||||
// 人员信息第1行(模板第2行)的分部和部门为必填
|
||||
if ((rowNum == 1 || rowNum == 2) && fieldName.equals("subcompanyid1") && getCellValue(1, cellNum).equals("所属分部") && cellValue.equals("")) {
|
||||
if ((rowNum == 1 || rowNum == 2) && fieldName.equals("subcompanyid1") && getCellValue(1, cellNum).equals("分部") && cellValue.equals("")) {
|
||||
flag = false;
|
||||
msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; //【分部】为必填
|
||||
errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83626, userlanguage));
|
||||
|
|
@ -652,28 +651,28 @@ public class HrmImportAdaptExcelE9 extends BaseBean implements IHrmImportAdapt {
|
|||
return flag;
|
||||
}
|
||||
|
||||
//// 岗位
|
||||
//if (fieldName.equals("jobtitle") && cellValue.equals("")) {
|
||||
// flag = false;
|
||||
// msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; //【岗位】为必填
|
||||
// errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83626, userlanguage));
|
||||
// return flag;
|
||||
//}
|
||||
//
|
||||
//if (fieldName.equals("jobactivityid") && cellValue.equals("")) {
|
||||
// flag = false;
|
||||
// msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; //【职务】为必填
|
||||
// errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83626, userlanguage));
|
||||
// return flag;
|
||||
//}
|
||||
//
|
||||
//
|
||||
//if (fieldName.equals("jobgroupid") && cellValue.equals("")) {
|
||||
// flag = false;
|
||||
// msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; //【职务类别】为必填
|
||||
// errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83626, userlanguage));
|
||||
// return flag;
|
||||
//}
|
||||
// 岗位
|
||||
if (fieldName.equals("jobtitle") && cellValue.equals("")) {
|
||||
flag = false;
|
||||
msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; //【岗位】为必填
|
||||
errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83626, userlanguage));
|
||||
return flag;
|
||||
}
|
||||
|
||||
if (fieldName.equals("jobactivityid") && cellValue.equals("")) {
|
||||
flag = false;
|
||||
msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; //【职务】为必填
|
||||
errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83626, userlanguage));
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
||||
if (fieldName.equals("jobgroupid") && cellValue.equals("")) {
|
||||
flag = false;
|
||||
msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; //【职务类别】为必填
|
||||
errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83626, userlanguage));
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
||||
// 办公地点
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.engine.common.util.ParamUtil;
|
|||
import com.engine.encrypt.biz.EncryptFieldConfigComInfo;
|
||||
import com.engine.hrm.entity.RuleCodeType;
|
||||
import com.engine.hrm.util.CodeRuleManager;
|
||||
import com.engine.hrm.util.HrmTriggerUtil;
|
||||
import com.engine.hrm.util.HrmWeakPasswordUtil;
|
||||
import com.engine.hrm.util.face.HrmFaceCheckManager;
|
||||
import com.engine.hrm.util.face.ValidateFieldManager;
|
||||
|
|
@ -13,8 +14,6 @@ import com.engine.hrm.util.face.bean.CheckItemBean;
|
|||
import com.engine.organization.entity.jclimport.po.JclImportHistoryDetailPO;
|
||||
import com.engine.organization.mapper.jclimport.JclImportHistoryDetailMapper;
|
||||
import com.engine.organization.mapper.jclimport.JclImportHistoryMapper;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
import com.engine.organization.thread.HrmResourceTriggerRunnable;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.weaver.integration.ldap.sync.oa.OaSync;
|
||||
import com.weaver.integration.ldap.util.AuthenticUtil;
|
||||
|
|
@ -232,8 +231,8 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
Class<HrmResourceVo> voClass = HrmResourceVo.class;
|
||||
|
||||
String field = "id,subcompanyid1,departmentid,workcode,lastname,"
|
||||
+ "loginid,password,seclevel,sex,"
|
||||
+ "managerid,assistantid,status,locationid,workroom,"
|
||||
+ "loginid,password,seclevel,sex,jobtitle,jobcall,joblevel,"
|
||||
+ "jobactivitydesc,managerid,assistantid,status,locationid,workroom,"
|
||||
+ "telephone,mobile,mobilecall,fax,email,"
|
||||
+ "systemlanguage,birthday,folk,nativeplace,regresidentplace,"
|
||||
+ "certificatenum,maritalstatus,policy,bememberdate,bepartydate,"
|
||||
|
|
@ -426,29 +425,15 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
hrm.setAccounttype(0);
|
||||
}
|
||||
|
||||
//// 岗位id
|
||||
//if (vo.getJobtitle() != null && vo.getJobactivityid() != null && vo.getJobgroupid() != null) {
|
||||
// int jobtitle = getJobTitles(vo.getJobtitle(), vo
|
||||
// .getJobactivityid(), vo.getJobgroupid());
|
||||
// /// -1:职务类别不存在,-2:职务不存在,-3:职务类别不存在
|
||||
// if (jobtitle == -1) {
|
||||
// resultList.add(createLog(vo, "创建", "失败", "职务类别不存在"));
|
||||
// continue;
|
||||
// } else if (jobtitle == -2) {
|
||||
// resultList.add(createLog(vo, "创建", "失败", "职务不存在"));
|
||||
// continue;
|
||||
// } else if (jobtitle == -3) {
|
||||
// resultList.add(createLog(vo, "创建", "失败", "岗位名称不存在"));
|
||||
// continue;
|
||||
// }
|
||||
// hrm.setJobtitle(jobtitle);
|
||||
//} else {
|
||||
// resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(83531, userlanguage)));
|
||||
// continue;
|
||||
//}
|
||||
|
||||
// 担任岗位字段校验
|
||||
|
||||
// 岗位id
|
||||
if (vo.getJobtitle() != null && vo.getJobactivityid() != null && vo.getJobgroupid() != null) {
|
||||
int jobtitle = getJobTitles(vo.getJobtitle(), vo
|
||||
.getJobactivityid(), vo.getJobgroupid());
|
||||
hrm.setJobtitle(jobtitle);
|
||||
} else {
|
||||
resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(83531, userlanguage)));
|
||||
continue;
|
||||
}
|
||||
|
||||
//上级id
|
||||
if (vo.getManagerid() != null) {
|
||||
|
|
@ -636,12 +621,12 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
}
|
||||
|
||||
//职级
|
||||
//if (isInteger(vo.getJoblevel())) {
|
||||
// int joblevel = vo.getJoblevel().equals("") ? 0 : Integer.parseInt(vo.getJoblevel());
|
||||
// hrm.setJoblevel((short) joblevel);
|
||||
//} else {
|
||||
// hrm.setJoblevel((short) 0);
|
||||
//}
|
||||
if (isInteger(vo.getJoblevel())) {
|
||||
int joblevel = vo.getJoblevel().equals("") ? 0 : Integer.parseInt(vo.getJoblevel());
|
||||
hrm.setJoblevel((short) joblevel);
|
||||
} else {
|
||||
hrm.setJoblevel((short) 0);
|
||||
}
|
||||
//用工性质
|
||||
if (vo.getUsekind() != null) {
|
||||
int usekind = getUseKind(vo.getUsekind());
|
||||
|
|
@ -830,7 +815,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
|
||||
new HrmDateCheck().calWorkInfo("" + id);
|
||||
// 刷新组织结构图
|
||||
new Thread(new HrmResourceTriggerRunnable((long) id)).start();
|
||||
// TODO new Thread(new HrmResourceTriggerRunnable((long) id)).start();
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -854,7 +839,6 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
if (this.checkInfo(vo, resultList)) {
|
||||
continue;
|
||||
}
|
||||
new BaseBean().writeLog("checkKeys校验通过");
|
||||
|
||||
if (vo.getAccounttype() == null || "".equalsIgnoreCase(Util.null2String(vo.getAccounttype()))) {
|
||||
if (StringUtil.isNotNull(vo.getCertificatenum()) && certificateNums.get(StringUtil.vString(vo.getCertificatenum())) != null) {
|
||||
|
|
@ -888,6 +872,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
issameSub = false;
|
||||
|
||||
}
|
||||
|
||||
if (subcompanyid1 == -9) {
|
||||
resultList.add(createLog(vo, "更新", "失败", SystemEnv.getErrorMsgName(56, userlanguage)));
|
||||
continue;
|
||||
|
|
@ -975,49 +960,36 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
}
|
||||
}
|
||||
|
||||
//// 岗位id
|
||||
//if ("".equals(Util.null2String(vo.getJobtitle())) && (!"".equals(Util.null2String(vo.getJobactivityid())) || !"".equals(Util.null2String(vo.getJobgroupid())))) {
|
||||
// resultList.add(createLog(vo, "更新", "失败", SystemEnv.getHtmlLabelName(83544, userlanguage)));
|
||||
// continue;
|
||||
//}
|
||||
//if (!"".equals(Util.null2String(vo.getJobtitle()))) {
|
||||
// String jobtitle;
|
||||
// String jobactivityid;
|
||||
// String jobactivityname;
|
||||
// String jobgroupid;
|
||||
// String jobgroupname;
|
||||
// if (vo.getJobactivityid() == null) {
|
||||
// jobtitle = resourcecominfo.getJobTitle(hrmId);
|
||||
// jobactivityid = jobTitlesComInfo.getJobactivityid(jobtitle);
|
||||
// jobactivityname = jobActivitiesComInfo.getJobActivitiesname(jobactivityid);
|
||||
// } else
|
||||
// jobactivityname = vo.getJobactivityid();
|
||||
// if (vo.getJobgroupid() == null) {
|
||||
// jobtitle = resourcecominfo.getJobTitle(hrmId);
|
||||
// jobactivityid = jobTitlesComInfo.getJobactivityid(jobtitle);
|
||||
// jobgroupid = jobActivitiesComInfo.getJobgroupid(jobactivityid);
|
||||
// jobgroupname = jobGroupsComInfo.getJobGroupsname(jobgroupid);
|
||||
// } else {
|
||||
// jobgroupname = vo.getJobgroupid();
|
||||
// }
|
||||
// int jobtitleid = getJobTitles(vo.getJobtitle(), jobactivityname, jobgroupname);
|
||||
// if (jobtitleid == -1) {
|
||||
// resultList.add(createLog(vo, "创建", "失败", "职务类别不存在"));
|
||||
// continue;
|
||||
// } else if (jobtitleid == -2) {
|
||||
// resultList.add(createLog(vo, "创建", "失败", "职务不存在"));
|
||||
// continue;
|
||||
// } else if (jobtitleid == -3) {
|
||||
// resultList.add(createLog(vo, "创建", "失败", "岗位名称不存在"));
|
||||
// continue;
|
||||
// }
|
||||
// hrm.setJobtitle(jobtitleid);
|
||||
//}
|
||||
|
||||
new BaseBean().writeLog("hrmId【" + hrmId + "】");
|
||||
if (Util.getIntValue(hrmId) < 0) {
|
||||
// 岗位id
|
||||
if ("".equals(Util.null2String(vo.getJobtitle())) && (!"".equals(Util.null2String(vo.getJobactivityid())) || !"".equals(Util.null2String(vo.getJobgroupid())))) {
|
||||
resultList.add(createLog(vo, "更新", "失败", SystemEnv.getHtmlLabelName(83544, userlanguage)));
|
||||
continue;
|
||||
}
|
||||
if (!"".equals(Util.null2String(vo.getJobtitle()))) {
|
||||
String jobtitle = "";
|
||||
String jobactivityid = "";
|
||||
String jobactivityname = "";
|
||||
String jobgroupid = "";
|
||||
String jobgroupname = "";
|
||||
if (vo.getJobactivityid() == null) {
|
||||
jobtitle = resourcecominfo.getJobTitle(hrmId);
|
||||
jobactivityid = jobTitlesComInfo.getJobactivityid(jobtitle);
|
||||
jobactivityname = jobActivitiesComInfo.getJobActivitiesname(jobactivityid);
|
||||
} else
|
||||
jobactivityname = vo.getJobactivityid();
|
||||
if (vo.getJobgroupid() == null) {
|
||||
jobtitle = resourcecominfo.getJobTitle(hrmId);
|
||||
jobactivityid = jobTitlesComInfo.getJobactivityid(jobtitle);
|
||||
jobgroupid = jobActivitiesComInfo.getJobgroupid(jobactivityid);
|
||||
jobgroupname = jobGroupsComInfo.getJobGroupsname(jobgroupid);
|
||||
} else {
|
||||
jobgroupname = vo.getJobgroupid();
|
||||
}
|
||||
int jobtitleid = getJobTitles(vo.getJobtitle(), jobactivityname, jobgroupname);
|
||||
hrm.setJobtitle(new Integer(jobtitleid));
|
||||
}
|
||||
|
||||
if (Util.getIntValue(hrmId) < 0) continue;
|
||||
|
||||
//上级id
|
||||
String managerstr = ""; //所有上级
|
||||
|
|
@ -1216,10 +1188,10 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
}
|
||||
|
||||
//职级
|
||||
//if (isInteger(vo.getJoblevel())) {
|
||||
// int joblevel = vo.getJoblevel().equals("") ? 0 : Integer.parseInt(vo.getJoblevel());
|
||||
// hrm.setJoblevel((short) joblevel);
|
||||
//}
|
||||
if (isInteger(vo.getJoblevel())) {
|
||||
int joblevel = vo.getJoblevel().equals("") ? 0 : Integer.parseInt(vo.getJoblevel());
|
||||
hrm.setJoblevel((short) joblevel);
|
||||
}
|
||||
|
||||
//用工性质
|
||||
if (vo.getUsekind() != null) {
|
||||
|
|
@ -1439,7 +1411,6 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
String nowmanagerstr = Util.null2String(recordSet.getString("managerstr"));
|
||||
String resourceid = recordSet.getString("id");
|
||||
//指定上级为自身的情况,不更新自身上级
|
||||
new BaseBean().writeLog("resourceid【" + resourceid + "】");
|
||||
if (hrmId.equals(resourceid)) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -1514,7 +1485,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
resultList.add(createLog(vo, "更新", "失败", "系统错误,请联系管理员"));
|
||||
}
|
||||
// 刷新组织结构图
|
||||
new Thread(new HrmResourceTriggerRunnable((long) keyMap.get(key))).start();
|
||||
// TODO new Thread(new HrmResourceTriggerRunnable((long) keyMap.get(key))).start();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//数据异常
|
||||
|
|
@ -1596,17 +1567,6 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
fielddbType = jsonObject.getString("fielddbtype");
|
||||
jsonObject.put("fieldvalue", baseValues[i]);
|
||||
String fieldvalue = HrmFieldManager.getReallyFieldvalue(jsonObject);
|
||||
// 处理自动获取时,或取到已删除的数据
|
||||
if ("field100002".equalsIgnoreCase(fieldname)) {
|
||||
// 根据分部、部门,获取对应的岗位ID
|
||||
recordSet.execute("select subcompanyid1,departmentid from hrmresource where id = " + id);
|
||||
while (recordSet.next()) {
|
||||
String ecCompany = recordSet.getString("subcompanyid1");
|
||||
String ecDepartment = recordSet.getString("departmentid");
|
||||
Long jobId = MapperProxyFactory.getProxy(JobMapper.class).getIdByNameAndEcId(baseValues[i], ecCompany, ecDepartment);
|
||||
fieldvalue = null == jobId ? "" : jobId.toString();
|
||||
}
|
||||
}
|
||||
|
||||
EncryptFieldEntity encryptFieldEntity = new EncryptFieldConfigComInfo().getFieldEncryptConfig("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId);
|
||||
if (encryptFieldEntity != null && "1".equals(encryptFieldEntity.getIsEncrypt())) {
|
||||
|
|
@ -1688,18 +1648,6 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
fielddbType = jsonObject.getString("fielddbtype");
|
||||
jsonObject.put("fieldvalue", baseValues[i]);
|
||||
String fieldvalue = HrmFieldManager.getReallyFieldvalue(jsonObject);
|
||||
// 处理自动获取时,或取到已删除的数据
|
||||
if ("field100002".equalsIgnoreCase(fieldname)) {
|
||||
// 根据分部、部门,获取对应的岗位ID
|
||||
recordSet.execute("select subcompanyid1,departmentid from hrmresource where id = " + id);
|
||||
while (recordSet.next()) {
|
||||
String ecCompany = recordSet.getString("subcompanyid1");
|
||||
String ecDepartment = recordSet.getString("departmentid");
|
||||
Long jobId = MapperProxyFactory.getProxy(JobMapper.class).getIdByNameAndEcId(baseValues[i], ecCompany, ecDepartment);
|
||||
fieldvalue = null == jobId ? "" : jobId.toString();
|
||||
new BaseBean().writeLog("岗位[" + baseValues[i] + "],jobId[" + Util.null2String(jobId) + "],ecCompany[" + ecCompany + "],ecDepartment[" + ecDepartment + "]");
|
||||
}
|
||||
}
|
||||
EncryptFieldEntity encryptFieldEntity = new EncryptFieldConfigComInfo().getFieldEncryptConfig("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId);
|
||||
if (encryptFieldEntity != null && "1".equals(encryptFieldEntity.getIsEncrypt())) {
|
||||
//是否需要加密
|
||||
|
|
@ -1711,7 +1659,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
if (fieldvalue.endsWith(",")) {
|
||||
fieldvalue = fieldvalue.substring(0, fieldvalue.length() - 1);
|
||||
}
|
||||
if (!"".equals(fieldvalue) || "field100002".equalsIgnoreCase(fieldname)) {
|
||||
if (!"".equals(fieldvalue)) {
|
||||
flag = true;
|
||||
if (fielddbType.toLowerCase().startsWith("char") || fielddbType.toLowerCase().startsWith("varchar") || fielddbType.toLowerCase().startsWith("text")) {
|
||||
setStr.append(",").append(baseFields[i]).append("='").append(fieldvalue).append("'");
|
||||
|
|
@ -1822,8 +1770,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
if (!recordSet.next()) {
|
||||
return !addPersonData(personFild, personValue, id);
|
||||
}
|
||||
new BaseBean().writeLog("personValue【" + personValue + "】");
|
||||
new BaseBean().writeLog("personFild【" + personFild + "】");
|
||||
|
||||
String[] personValues = personValue.split(";");
|
||||
String[] personFields = personFild.split(",");
|
||||
String fielddbType;
|
||||
|
|
@ -2149,68 +2096,93 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
return currentId;
|
||||
}
|
||||
|
||||
///**
|
||||
// * 获取岗位id
|
||||
// *
|
||||
// * @param jobtitlename 岗位名称
|
||||
// * @param jobactivityname 职务
|
||||
// * @param jobgroupname 职务类别
|
||||
// * @return -1:职务类别不存在,-2:职务不存在,-3:岗位名称不存在
|
||||
// */
|
||||
//public int getJobTitles(String jobtitlename, String jobactivityname,
|
||||
// String jobgroupname) {
|
||||
// RecordSet rs = new RecordSet();
|
||||
// RecordSet recordSet = new RecordSet();
|
||||
// String sqlInsert;
|
||||
//
|
||||
// jobgroupname = Util.convertInput2DB4(jobgroupname);
|
||||
// jobactivityname = Util.convertInput2DB4(jobactivityname);
|
||||
//
|
||||
// /* 获取jobgroupid 职务类别 */
|
||||
// String selSql = "select id from HrmJobGroups where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(jobgroupname))," + userlanguage + ")))='" + jobgroupname + "'";
|
||||
// if (recordSet.getDBType().equalsIgnoreCase("oracle") || DialectUtil.isMySql(recordSet.getDBType()) || recordSet.getDBType().equalsIgnoreCase("postgresql")) {
|
||||
// selSql = "select id from HrmJobGroups where ltrim(rtrim(convToMultiLang(ltrim(rtrim(jobgroupname))," + userlanguage + ")))='" + jobgroupname + "'";
|
||||
// }
|
||||
//
|
||||
// int jobgroupid = getResultSetId(selSql);
|
||||
//
|
||||
// if (jobgroupid == 0) {
|
||||
// return -1;
|
||||
// }
|
||||
//
|
||||
// /* 获取jobactivityid 职务 */
|
||||
// selSql = "select id from HrmJobActivities where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(jobactivityname))," + userlanguage + ")))='" + jobactivityname + "' and jobgroupid=" + jobgroupid;
|
||||
// if (recordSet.getDBType().equalsIgnoreCase("oracle") || DialectUtil.isMySql(recordSet.getDBType()) || recordSet.getDBType().equalsIgnoreCase("postgresql")) {
|
||||
// selSql = "select id from HrmJobActivities where ltrim(rtrim(convToMultiLang(ltrim(rtrim(jobactivityname))," + userlanguage + ")))='" + jobactivityname + "' and jobgroupid=" + jobgroupid;
|
||||
// }
|
||||
//
|
||||
// int jobactivityid = getResultSetId(selSql);
|
||||
//
|
||||
// if (jobactivityid == 0) {
|
||||
// return -2;
|
||||
// }
|
||||
//
|
||||
// /*获取岗位id*/
|
||||
// selSql = "select id from HrmJobTitles where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(jobtitlemark))," + userlanguage + ")))='" + jobtitlename + "' and jobactivityid=" + jobactivityid;
|
||||
// if (recordSet.getDBType().equalsIgnoreCase("oracle") || DialectUtil.isMySql(recordSet.getDBType()) || recordSet.getDBType().equalsIgnoreCase("postgresql")) {
|
||||
// selSql = "select id from HrmJobTitles where ltrim(rtrim(convToMultiLang(ltrim(rtrim(jobtitlemark))," + userlanguage + ")))='" + jobtitlename + "' and jobactivityid=" + jobactivityid;
|
||||
// }
|
||||
//
|
||||
// int jobtitle = getResultSetId(selSql);
|
||||
//
|
||||
// if (jobtitle == 0) {
|
||||
// return -3;
|
||||
//
|
||||
// } else {
|
||||
// selSql = "select * from HrmJobTitles where id = '" + jobtitle + "' and jobactivityid = '" + jobactivityid + "' ";
|
||||
// recordSet.executeSql(selSql);
|
||||
// if (!recordSet.next()) {//查询这个名称已存在的岗位,对应的职务是否存在。如果对应职务的岗位不存在,则说明岗位对应的职务和职务类别有更新
|
||||
// sqlInsert = "update HrmJobTitles set jobactivityid = '" + jobactivityid + "'," + DbFunctionUtil.getUpdateSetSql(rs.getDBType(), 1) + " where id = '" + jobtitle + "' ";
|
||||
// rs.executeSql(sqlInsert);
|
||||
// }
|
||||
// }
|
||||
// return jobtitle;
|
||||
//}
|
||||
/**
|
||||
* 获取岗位id
|
||||
*
|
||||
* @param jobtitlename 岗位名称
|
||||
* @param jobactivityname 职务
|
||||
* @param jobgroupname 职务类型
|
||||
* @return
|
||||
*/
|
||||
public int getJobTitles(String jobtitlename, String jobactivityname,
|
||||
String jobgroupname) {
|
||||
RecordSet rs = new RecordSet();
|
||||
RecordSet recordSet = new RecordSet();
|
||||
String sqlInsert = "";
|
||||
|
||||
jobgroupname = Util.convertInput2DB4(jobgroupname);
|
||||
jobactivityname = Util.convertInput2DB4(jobactivityname);
|
||||
|
||||
/* 获取jobgroupid 职务类别 */
|
||||
String selSql = "select id from HrmJobGroups where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(jobgroupname))," + userlanguage + ")))='" + jobgroupname + "'";
|
||||
if (recordSet.getDBType().equalsIgnoreCase("oracle") || DialectUtil.isMySql(recordSet.getDBType()) || recordSet.getDBType().equalsIgnoreCase("postgresql")) {
|
||||
selSql = "select id from HrmJobGroups where ltrim(rtrim(convToMultiLang(ltrim(rtrim(jobgroupname))," + userlanguage + ")))='" + jobgroupname + "'";
|
||||
}
|
||||
|
||||
int jobgroupid = getResultSetId(selSql);
|
||||
|
||||
if (jobgroupid == 0) {
|
||||
if (jobgroupname.length() == 0) {
|
||||
selSql = "select max(id) as id from HrmJobGroups";
|
||||
jobgroupid = getResultSetId(selSql);
|
||||
} else {
|
||||
sqlInsert = "insert into HrmJobGroups (jobgroupname,jobgroupremark ," + DbFunctionUtil.getInsertColumnSql() + ") values('"
|
||||
+ jobgroupname + "','" + jobgroupname + "'," + DbFunctionUtil.getInsertColumnValueSql(recordSet.getDBType(), 1) + ")"; // 创建
|
||||
execSql(sqlInsert);
|
||||
jobgroupid = getResultSetId(selSql);
|
||||
}
|
||||
}
|
||||
|
||||
/* 获取jobactivityid 职务 */
|
||||
selSql = "select id from HrmJobActivities where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(jobactivityname))," + userlanguage + ")))='" + jobactivityname + "' and jobgroupid=" + jobgroupid;
|
||||
if (recordSet.getDBType().equalsIgnoreCase("oracle") || DialectUtil.isMySql(recordSet.getDBType()) || recordSet.getDBType().equalsIgnoreCase("postgresql")) {
|
||||
selSql = "select id from HrmJobActivities where ltrim(rtrim(convToMultiLang(ltrim(rtrim(jobactivityname))," + userlanguage + ")))='" + jobactivityname + "' and jobgroupid=" + jobgroupid;
|
||||
}
|
||||
|
||||
int jobactivityid = getResultSetId(selSql);
|
||||
|
||||
if (jobactivityid == 0) {
|
||||
sqlInsert = "insert into HrmJobActivities (jobactivityname,Jobactivitymark,jobgroupid ," + DbFunctionUtil.getInsertColumnSql() + ") values('"
|
||||
+ jobactivityname + "','" + jobactivityname + "'," + jobgroupid + " ," + DbFunctionUtil.getInsertColumnValueSql(recordSet.getDBType(), 1) + ")"; // 创建
|
||||
execSql(sqlInsert);
|
||||
jobactivityid = getResultSetId(selSql);
|
||||
}
|
||||
|
||||
/*获取岗位id*/
|
||||
selSql = "select id from HrmJobTitles where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(jobtitlemark))," + userlanguage + ")))='" + jobtitlename + "' and jobactivityid=" + jobactivityid;
|
||||
if (recordSet.getDBType().equalsIgnoreCase("oracle") || DialectUtil.isMySql(recordSet.getDBType()) || recordSet.getDBType().equalsIgnoreCase("postgresql")) {
|
||||
selSql = "select id from HrmJobTitles where ltrim(rtrim(convToMultiLang(ltrim(rtrim(jobtitlemark))," + userlanguage + ")))='" + jobtitlename + "' and jobactivityid=" + jobactivityid;
|
||||
}
|
||||
|
||||
int jobtitle = getResultSetId(selSql);
|
||||
|
||||
if (jobtitle == 0) {
|
||||
String jobtitlecode = "";
|
||||
try {
|
||||
jobtitlecode = CodeRuleManager.getCodeRuleManager().generateRuleCode(RuleCodeType.JOBTITLES, jobtitlecode);
|
||||
} catch (Exception e) {
|
||||
writeLog(e);
|
||||
}
|
||||
sqlInsert = "insert into HrmJobTitles (jobtitlename,Jobtitlemark,jobactivityid ," + DbFunctionUtil.getInsertColumnSql() + ", jobtitlecode) values('"
|
||||
+ jobtitlename + "','" + jobtitlename + "'," + jobactivityid + " ," + DbFunctionUtil.getInsertColumnValueSql(recordSet.getDBType(), 1) + ", '" + jobtitlecode + "')"; // 创建
|
||||
execSql(sqlInsert);
|
||||
HrmTriggerUtil.generateJobtitlesPinyin(jobtitlename, null);
|
||||
jobtitle = getResultSetId(selSql);
|
||||
|
||||
HrmFaceCheckManager.sync(jobtitle + "", HrmFaceCheckManager.getOptInsert(), "hrm_e9_import_getJobtitles", HrmFaceCheckManager.getOaJobtitle());
|
||||
|
||||
} else {
|
||||
selSql = "select * from HrmJobTitles where id = '" + jobtitle + "' and jobactivityid = '" + jobactivityid + "' ";
|
||||
recordSet.executeSql(selSql);
|
||||
if (!recordSet.next()) {//查询这个名称已存在的岗位,对应的职务是否存在。如果对应职务的岗位不存在,则说明岗位对应的职务和职务类别有更新
|
||||
sqlInsert = "update HrmJobTitles set jobactivityid = '" + jobactivityid + "'," + DbFunctionUtil.getUpdateSetSql(rs.getDBType(), 1) + " where id = '" + jobtitle + "' ";
|
||||
rs.executeSql(sqlInsert);
|
||||
}
|
||||
}
|
||||
return jobtitle;
|
||||
}
|
||||
|
||||
|
||||
public static boolean needCheckLicenseForUpdate(ResourceComInfo resourceComInfo, String hrmId, HrmResourceVo vo) {
|
||||
String statusOfHrmId = resourceComInfo.getStatus(hrmId);
|
||||
String loginidOfHrmId = resourceComInfo.getLoginID(hrmId);
|
||||
|
|
|
|||
|
|
@ -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