部门管理功能逻辑调整

pull/79/head
dxfeng 3 years ago
parent 1c8c7ab2aa
commit 40a6540a1d

@ -195,18 +195,18 @@ public class JobBrowserService extends BrowserService {
} else if ("1".equals(params.getType())) { } else if ("1".equals(params.getType())) {
// 当前节点下的元素 // 当前节点下的元素
CompanyPO compBuild = CompanyPO.builder().supSubComId(Integer.parseInt(params.getId())).canceled(0).build(); CompanyPO compBuild = CompanyPO.builder().supSubComId(Integer.parseInt(params.getId())).canceled(0).build();
List<CompanyPO> compList = MapperProxyFactory.getProxy(CompanyMapper.class).listByFilter(compBuild, "show_order"); List<CompanyPO> compList = MapperProxyFactory.getProxy(CompanyMapper.class).listByFilter(compBuild, "showorder");
if (detachUtil.isDETACH()) { if (detachUtil.isDETACH()) {
detachUtil.filterCompanyList(compList); detachUtil.filterCompanyList(compList);
} }
DepartmentPO departmentBuild = DepartmentPO.builder().subCompanyId1(Integer.parseInt(params.getId())).canceled(0).build(); DepartmentPO departmentBuild = DepartmentPO.builder().subCompanyId1(Integer.parseInt(params.getId())).canceled(0).build();
List<DepartmentPO> departmentList = MapperProxyFactory.getProxy(DepartmentMapper.class).listByFilter(departmentBuild, "show_order"); List<DepartmentPO> departmentList = MapperProxyFactory.getProxy(DepartmentMapper.class).listByFilter(departmentBuild, "showorder");
compList.forEach(item -> buildCompNodes(treeNodes, compHasSubs, item)); compList.forEach(item -> buildCompNodes(treeNodes, compHasSubs, item));
departmentList.stream().filter(item -> null == item.getSupDepId() || 0 == item.getSupDepId()).forEach(item -> buildDeptNodes(treeNodes, hasSubDepartment, item)); departmentList.stream().filter(item -> null == item.getSupDepId() || 0 == item.getSupDepId()).forEach(item -> buildDeptNodes(treeNodes, hasSubDepartment, item));
} else if ("2".equals(params.getType())) { } else if ("2".equals(params.getType())) {
DepartmentPO departmentBuild = DepartmentPO.builder().supDepId(Integer.parseInt(params.getId())).canceled(0).build(); DepartmentPO departmentBuild = DepartmentPO.builder().supDepId(Integer.parseInt(params.getId())).canceled(0).build();
List<DepartmentPO> departmentList = MapperProxyFactory.getProxy(DepartmentMapper.class).listByFilter(departmentBuild, "show_order"); List<DepartmentPO> departmentList = MapperProxyFactory.getProxy(DepartmentMapper.class).listByFilter(departmentBuild, "showorder");
departmentList.forEach(item -> buildDeptNodes(treeNodes, hasSubDepartment, item)); departmentList.forEach(item -> buildDeptNodes(treeNodes, hasSubDepartment, item));
} }

@ -132,7 +132,7 @@ public class DepartmentBO {
return departmentPOS.stream().map(item -> { return departmentPOS.stream().map(item -> {
SearchTree tree = new SearchTree(); SearchTree tree = new SearchTree();
tree.setCanClick(true); tree.setCanClick(true);
tree.setCanceled(item.getCanceled() != 0); tree.setCanceled(item.getCanceled() != null && item.getCanceled() != 0);
tree.setIcon(isLeaf ? "icon-coms-Branch" : "icon-coms-LargeArea"); tree.setIcon(isLeaf ? "icon-coms-Branch" : "icon-coms-LargeArea");
tree.setId(item.getId().toString()); tree.setId(item.getId().toString());
tree.setIsParent(false); tree.setIsParent(false);

@ -34,7 +34,7 @@ public class JobBO {
.ecCompany(param.getEcCompany()) .ecCompany(param.getEcCompany())
.ecDepartment(param.getEcDepartment()) .ecDepartment(param.getEcDepartment())
.parentComp(param.getSubcompanyid1()) .parentComp(param.getSubcompanyid1())
.parentDept( param.getDepartmentid()) .parentDept(param.getDepartmentid())
.sequenceId(param.getSequenceId()) .sequenceId(param.getSequenceId())
.schemeId(param.getSchemeId()) .schemeId(param.getSchemeId())
.parentJob(param.getParentJob()) .parentJob(param.getParentJob())
@ -83,8 +83,8 @@ public class JobBO {
.id(e.getId()) .id(e.getId())
.jobNo(e.getJobNo()) .jobNo(e.getJobNo())
.jobName(e.getJobName()) .jobName(e.getJobName())
.compName(e.getCompName()) .subCompanyName(e.getSubCompanyName())
.deptName(e.getDeptName()) .departmentName(e.getDepartmentName())
.sequenceName(e.getSequenceName()) .sequenceName(e.getSequenceName())
.schemeName(e.getSchemeName()) .schemeName(e.getSchemeName())
//.parentJob(e.getParentJob()) //.parentJob(e.getParentJob())

@ -34,7 +34,7 @@ public class JobListDTO {
/** /**
* *
*/ */
@TableTitle(title = "名称", dataIndex = "jobName", key = "jobName",width = "150") @TableTitle(title = "名称", dataIndex = "jobName", key = "jobName", width = "150")
private String jobName; private String jobName;
/** /**
* *
@ -44,13 +44,13 @@ public class JobListDTO {
/** /**
* *
*/ */
@TableTitle(title = "所属分部", dataIndex = "compName", key = "compName") @TableTitle(title = "所属分部", dataIndex = "subCompanyName", key = "subCompanyName")
private String compName; private String subCompanyName;
/** /**
* *
*/ */
@TableTitle(title = "所属部门", dataIndex = "deptName", key = "deptName") @TableTitle(title = "所属部门", dataIndex = "departmentName", key = "departmentName")
private String deptName; private String departmentName;
/** /**
* *
*/ */

@ -176,7 +176,7 @@ public interface JobMapper {
* @param parentCompany * @param parentCompany
* @return * @return
*/ */
int updateJobCompany(@Param("ids") Collection<Long> ids, @Param("parentCompany") Integer parentCompany, @Param("ecCompany") String ecCompany); int updateJobCompany(@Param("ids") Collection<Long> ids, @Param("parentCompany") Integer parentCompany, @Param("ecCompany") Integer ecCompany);
int isHasResource(@Param("jobId") Long jobId); int isHasResource(@Param("jobId") Long jobId);
} }

@ -367,16 +367,16 @@
<select id="listByFilter" resultType="com.engine.organization.entity.job.dto.JobListDTO" <select id="listByFilter" resultType="com.engine.organization.entity.job.dto.JobListDTO"
parameterType="com.engine.organization.entity.job.po.JobPO"> parameterType="com.engine.organization.entity.job.po.JobPO">
SELECT SELECT
a.comp_name , a.subcompanyname ,
b.dept_name , b.departmentname ,
c.sequence_name, c.sequence_name,
d.scheme_name, d.scheme_name,
<include refid="baseColumns"/> <include refid="baseColumns"/>
FROM jcl_org_job t FROM jcl_org_job t
left join jcl_org_comp a on left join hrmsubcompany a on
t.parent_comp = a.id t.ec_company = a.id
left join jcl_org_dept b on left join hrmdepartment b on
t.parent_dept = b.id t.ec_department = b.id
left join jcl_org_sequence c on left join jcl_org_sequence c on
t.sequence_id = c.id t.sequence_id = c.id
left join jcl_org_scheme d on left join jcl_org_scheme d on
@ -415,16 +415,16 @@
<select id="listNoFilter" resultType="com.engine.organization.entity.job.dto.JobListDTO"> <select id="listNoFilter" resultType="com.engine.organization.entity.job.dto.JobListDTO">
SELECT SELECT
a.comp_name , a.subcompanyname ,
b.dept_name , b.departmentname ,
c.sequence_name, c.sequence_name,
d.scheme_name, d.scheme_name,
<include refid="baseColumns"/> <include refid="baseColumns"/>
FROM jcl_org_job t FROM jcl_org_job t
left join jcl_org_comp a on left join hrmsubcompany a on
t.parent_comp = a.id t.ec_company = a.id
left join jcl_org_dept b on left join hrmdepartment b on
t.parent_dept = b.id t.ec_department = b.id
left join jcl_org_sequence c on left join jcl_org_sequence c on
t.sequence_id = c.id t.sequence_id = c.id
left join jcl_org_scheme d on left join jcl_org_scheme d on

@ -33,7 +33,10 @@
<!-- 表字段 --> <!-- 表字段 -->
<sql id="baseColumns"> <sql id="baseColumns">
t.id,t.work_code,t.last_name,t.sex,t.status,t.account_type, t
.
id
,t.work_code,t.last_name,t.sex,t.status,t.account_type,
t.belong_to,t.ec_company,t.job_title,t.ec_department,t. t.belong_to,t.ec_company,t.job_title,t.ec_department,t.
scheme_id,t.sequence_id,t.job_grade,t.job_level,t.job_group_id, scheme_id,t.sequence_id,t.job_grade,t.job_level,t.job_group_id,
t.job_activity,t.location_id,t.show_order,t.company_start_date, t.job_activity,t.location_id,t.show_order,t.company_start_date,
@ -53,11 +56,11 @@
</update> </update>
<select id="listAll" resultType="com.engine.organization.entity.hrmresource.vo.HrmResourceVO"> <select id="listAll" resultType="com.engine.organization.entity.hrmresource.vo.HrmResourceVO">
SELECT t.last_name as lastName,d.dept_name as departmentName, SELECT t.last_name as lastName,d.departmentname as departmentName,
c.comp_name as companyName,t.mobile,t.telephone,t1.last_name as managerName c.subcompanyname as companyName,t.mobile,t.telephone,t1.last_name as managerName
from jcl_org_hrmresource t from jcl_org_hrmresource t
left join JCL_ORG_DEPT d on t.department_id = d.id left join hrmdepartment d on t.ec_department = d.id
left join jcl_org_comp c on t.company_id = c.id left join hrmsubcompany c on t.ec_eompany = c.id
left join jcl_org_hrmresource t1 on t.manager_id = t1.id left join jcl_org_hrmresource t1 on t.manager_id = t1.id
where 1 = 1 where 1 = 1
<if test="ids != null and ids.size > 0"> <if test="ids != null and ids.size > 0">
@ -108,11 +111,11 @@
from jcl_org_hrmresource t where delete_type = 0 and work_code = #{workCode} from jcl_org_hrmresource t where delete_type = 0 and work_code = #{workCode}
</select> </select>
<select id="listDetachAll" resultType="com.engine.organization.entity.hrmresource.vo.HrmResourceVO"> <select id="listDetachAll" resultType="com.engine.organization.entity.hrmresource.vo.HrmResourceVO">
SELECT t.last_name as lastName,d.dept_name as departmentName, SELECT t.last_name as lastName,d.departmentname as departmentName,
c.comp_name as companyName,t.mobile,t.telephone,t1.last_name as managerName c.subcompanyname as companyName,t.mobile,t.telephone,t1.last_name as managerName
from jcl_org_hrmresource t from jcl_org_hrmresource t
left join JCL_ORG_DEPT d on t.department_id = d.id left join hrmdepartment d on t.ec_department = d.id
left join jcl_org_comp c on t.company_id = c.id left join hrmsubcompany c on t.ec_company = c.id
left join jcl_org_hrmresource t1 on t.manager_id = t1.id left join jcl_org_hrmresource t1 on t.manager_id = t1.id
where 1 = 1 where 1 = 1
<if test="ids != null and ids.size > 0"> <if test="ids != null and ids.size > 0">

@ -12,6 +12,4 @@ import java.sql.Date;
**/ **/
public interface JobTriggerMapper { public interface JobTriggerMapper {
Integer sumStaffNum(@Param("fdatebegin") Date fdatebegin, @Param("jobId") Integer jobId); Integer sumStaffNum(@Param("fdatebegin") Date fdatebegin, @Param("jobId") Integer jobId);
Integer countHrmResource(@Param("parentdept") Integer parentdept, @Param("fname") String fname);
} }

@ -11,12 +11,4 @@
and time_end &gt;= #{fdatebegin}) and time_end &gt;= #{fdatebegin})
and job_id = #{jobId} and job_id = #{jobId}
</select> </select>
<select id="countHrmResource" resultType="java.lang.Integer">
select count(1)
from hrmresource
where status &lt;= 3
and departmentid =
(select id from hrmdepartment where uuid = (select uuid from JCL_ORG_DEPT where id = #{parentdept}))
and jobtitle in (select id from hrmjobtitles where JOBTITLENAME = #{fname})
</select>
</mapper> </mapper>

@ -105,7 +105,7 @@ public class CompServiceImpl extends Service implements CompService {
CompanyPO companyPO = CompanyBO.convertParamToPO(params, user.getUID()); CompanyPO companyPO = CompanyBO.convertParamToPO(params, user.getUID());
boolean filter = isFilter(companyPO); boolean filter = isFilter(companyPO);
PageInfo<CompanyListDTO> pageInfos; PageInfo<CompanyListDTO> pageInfos;
String orderSql = PageInfoSortUtil.getSortSql(params.getSortParams()); String orderSql = PageInfoSortUtil.getSortSql(params.getSortParams()," showorder ");
List<CompanyPO> allList = getCompanyMapper().listAll(orderSql); List<CompanyPO> allList = getCompanyMapper().listAll(orderSql);
new DetachUtil(user.getUID()).filterCompanyList(allList); new DetachUtil(user.getUID()).filterCompanyList(allList);

@ -24,20 +24,15 @@ import com.engine.organization.entity.extend.po.ExtendTitlePO;
import com.engine.organization.entity.job.bo.JobBO; import com.engine.organization.entity.job.bo.JobBO;
import com.engine.organization.entity.job.po.JobPO; import com.engine.organization.entity.job.po.JobPO;
import com.engine.organization.entity.job.vo.SingleJobTreeVO; import com.engine.organization.entity.job.vo.SingleJobTreeVO;
import com.engine.organization.entity.map.JclOrgMap;
import com.engine.organization.entity.searchtree.SearchTree; import com.engine.organization.entity.searchtree.SearchTree;
import com.engine.organization.entity.searchtree.SearchTreeParams; import com.engine.organization.entity.searchtree.SearchTreeParams;
import com.engine.organization.enums.LogModuleNameEnum; import com.engine.organization.enums.LogModuleNameEnum;
import com.engine.organization.enums.ModuleTypeEnum;
import com.engine.organization.enums.OperateTypeEnum; import com.engine.organization.enums.OperateTypeEnum;
import com.engine.organization.exception.OrganizationRunTimeException; import com.engine.organization.exception.OrganizationRunTimeException;
import com.engine.organization.mapper.codesetting.CodeRuleMapper; import com.engine.organization.mapper.codesetting.CodeRuleMapper;
import com.engine.organization.mapper.comp.CompanyMapper; import com.engine.organization.mapper.comp.CompanyMapper;
import com.engine.organization.mapper.department.DepartmentMapper; import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.mapper.extend.ExtDTMapper;
import com.engine.organization.mapper.extend.ExtMapper;
import com.engine.organization.mapper.extend.ExtendTitleMapper; import com.engine.organization.mapper.extend.ExtendTitleMapper;
import com.engine.organization.mapper.jclorgmap.JclOrgMapper;
import com.engine.organization.mapper.job.JobMapper; import com.engine.organization.mapper.job.JobMapper;
import com.engine.organization.service.DepartmentService; import com.engine.organization.service.DepartmentService;
import com.engine.organization.service.ExtService; import com.engine.organization.service.ExtService;
@ -50,7 +45,6 @@ import com.engine.organization.util.detach.DetachUtil;
import com.engine.organization.util.page.Column; import com.engine.organization.util.page.Column;
import com.engine.organization.util.page.PageInfo; import com.engine.organization.util.page.PageInfo;
import com.engine.organization.util.page.PageUtil; import com.engine.organization.util.page.PageUtil;
import com.engine.organization.util.relation.EcHrmRelationUtil;
import com.engine.organization.util.tree.SearchTreeUtil; import com.engine.organization.util.tree.SearchTreeUtil;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
@ -173,7 +167,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
DepartmentPO departmentPO = DepartmentBO.convertParamsToPO(param, user.getUID()); DepartmentPO departmentPO = DepartmentBO.convertParamsToPO(param, user.getUID());
boolean filter = isFilter(departmentPO); boolean filter = isFilter(departmentPO);
PageInfo<DepartmentListDTO> pageInfos; PageInfo<DepartmentListDTO> pageInfos;
String orderSql = PageInfoSortUtil.getSortSql(param.getSortParams()); String orderSql = PageInfoSortUtil.getSortSql(param.getSortParams()," showorder ");
List<DepartmentPO> allList = getDepartmentMapper().listAll(orderSql); List<DepartmentPO> allList = getDepartmentMapper().listAll(orderSql);
new DetachUtil(user.getUID()).filterDepartmentList(allList); new DetachUtil(user.getUID()).filterDepartmentList(allList);
// 通过子级遍历父级元素 // 通过子级遍历父级元素
@ -528,6 +522,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
deptById.setSupDepId(parentDepartmentId); deptById.setSupDepId(parentDepartmentId);
// 显示顺序字段 // 显示顺序字段
deptById.setShowOrder(++maxShowOrder); deptById.setShowOrder(++maxShowOrder);
deptById.setUuid(null);
// 新增EC表部门 // 新增EC表部门
Map<String, Object> syncMap = addEcDepartment(deptById); Map<String, Object> syncMap = addEcDepartment(deptById);
@ -544,7 +539,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
if (maxJobOrder == null) { if (maxJobOrder == null) {
maxJobOrder = 0; maxJobOrder = 0;
} }
recursionCopyJob(jobPOS, companyId, deptById.getId(), null, maxJobOrder, timeMillis); recursionCopyJob(jobPOS, companyId, Integer.parseInt(ecDepartmentID), null, maxJobOrder, timeMillis);
} }
// 是否复制子部门信息 // 是否复制子部门信息
@ -553,7 +548,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
List<DepartmentPO> deptListByPId = getDepartmentMapper().getDeptListByPId(originalDeptId); List<DepartmentPO> deptListByPId = getDepartmentMapper().getDeptListByPId(originalDeptId);
for (DepartmentPO departmentPO : deptListByPId) { for (DepartmentPO departmentPO : deptListByPId) {
// 复制子部门信息、子部门岗位信息 // 复制子部门信息、子部门岗位信息
recursionCopyDept(departmentPO.getId(), deptById.getId(), companyId, maxShowOrder, copySubJob, copySubDept, copySubJob); recursionCopyDept(departmentPO.getId(), Integer.parseInt(ecDepartmentID), companyId, maxShowOrder, copySubJob, copySubDept, copySubJob);
} }
} }
} }
@ -579,17 +574,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
// 被合并部门 // 被合并部门
Integer ecParamDepartment = mergeParam.getDepartment(); Integer ecParamDepartment = mergeParam.getDepartment();
DepartmentPO targetDepartment = getDepartmentMapper().getDeptById(ecParamDepartment); DepartmentPO targetDepartment = getDepartmentMapper().getDeptById(ecParamDepartment);
// map表中合并部门parentID
Integer oldParamDepartment = mergeParam.getId();
DepartmentPO oldDepartment = getDepartmentMapper().getDeptById(oldParamDepartment);
Integer oldFParentId = null;
if (null != oldDepartment) {
java.sql.Date currentDate = new java.sql.Date(OrganizationDateUtil.stringToDate(OrganizationDateUtil.getFormatLocalDate(new Date())).getTime());
JclOrgMap jclOrgMap = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapByObjID(currentDate, ModuleTypeEnum.departmentfielddefined.getValue().toString(), oldDepartment.getId().toString());
if (null != jclOrgMap) {
oldFParentId = jclOrgMap.getFParentId();
}
}
// 断言判断 // 断言判断
OrganizationAssert.isFalse(null == targetDepartment, "被合并部门数据有误,暂时无法合并"); OrganizationAssert.isFalse(null == targetDepartment, "被合并部门数据有误,暂时无法合并");
@ -644,14 +629,11 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
forbiddenChildTag(targetDepartment.getSubCompanyId1(), Util.null2String(targetDepartment.getSubCompanyId1()), deptList); forbiddenChildTag(targetDepartment.getSubCompanyId1(), Util.null2String(targetDepartment.getSubCompanyId1()), deptList);
} }
// 原部门删除 // 原部门删除
DepartmentPO mergeDepartment = getDepartmentMapper().getDeptById(mergeParam.getId()); // DepartmentPO mergeDepartment = getDepartmentMapper().getDeptById(mergeParam.getId());
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("id", mergeParam.getId()); map.put("id", Util.null2String(mergeParam.getId()));
new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.CANCELED, map).sync(); // 删除部门
// 删除拓展表、明细表 ServiceUtil.getService(OrganizationServiceImpl.class, user).delDepartment(map, user);
MapperProxyFactory.getProxy(ExtMapper.class).deleteByID("jcl_org_deptext", mergeParam.getId());
MapperProxyFactory.getProxy(ExtDTMapper.class).deleteByMainID("jcl_org_deptext_dt1", mergeParam.getId(), null);
// TODO 删除 getDepartmentMapper().deleteByIds(DeleteParam.builder().ids(mergeParam.getId().toString()).build().getIds());
// 更新组织架构图 // 更新组织架构图
// TODO new DepartmentTriggerRunnable(mergeDepartment).run(); // TODO new DepartmentTriggerRunnable(mergeDepartment).run();
// 更新部门合并后名称 // 更新部门合并后名称
@ -725,7 +707,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
refreshJobComp(deptById.getId(), deptById.getSubCompanyId1()); refreshJobComp(deptById.getId(), deptById.getSubCompanyId1());
List<DepartmentPO> deptList = getDepartmentMapper().getDeptListByPId(deptById.getId()); List<DepartmentPO> deptList = getDepartmentMapper().getDeptListByPId(deptById.getId());
// 更新当前部门下的人员 // 更新当前部门下的人员
new RecordSet().executeUpdate("update hrmresource set SUBCOMPANYID1 =? where DEPARTMENTID = ?", deptById.getSubCompanyId1(), deptById.getId()); // new RecordSet().executeUpdate("update hrmresource set SUBCOMPANYID1 =? where DEPARTMENTID = ?", deptById.getSubCompanyId1(), deptById.getId());
//// 更新人员组织架构图 //// 更新人员组织架构图
//List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIdsByDept(deptById.getId().toString()); //List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIdsByDept(deptById.getId().toString());
//for (Long hrmResourceId : hrmResourceIds) { //for (Long hrmResourceId : hrmResourceIds) {
@ -754,9 +736,9 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
// 刷新岗位所属分部 // 刷新岗位所属分部
refreshJobComp(departmentPO.getId(), parentComp); refreshJobComp(departmentPO.getId(), parentComp);
// 更新当前部门下的人员 // 更新当前部门下的人员
String ecDepartmentId = EcHrmRelationUtil.getEcDepartmentId(departmentPO.getId().toString()); // String ecDepartmentId = EcHrmRelationUtil.getEcDepartmentId(departmentPO.getId().toString());
new RecordSet().executeUpdate("update hrmresource set SUBCOMPANYID1 =? where DEPARTMENTID = ?", ecCompanyId, ecDepartmentId); //new RecordSet().executeUpdate("update hrmresource set SUBCOMPANYID1 =? where DEPARTMENTID = ?", ecCompanyId, ecDepartmentId);
new RecordSet().executeUpdate("update jcl_org_hrmresource set company_id =? ,ec_company = ? where department_id =?", parentComp, ecCompanyId, departmentPO.getId()); //new RecordSet().executeUpdate("update jcl_org_hrmresource set company_id =? ,ec_company = ? where department_id =?", parentComp, ecCompanyId, departmentPO.getId());
//List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIdsByDept(departmentPO.getId().toString()); //List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIdsByDept(departmentPO.getId().toString());
//// 更新人员组织架构图 //// 更新人员组织架构图
//for (Long hrmResourceId : hrmResourceIds) { //for (Long hrmResourceId : hrmResourceIds) {
@ -905,12 +887,12 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("departmentmark", departmentPO.getDepartmentMark()); map.put("departmentmark", departmentPO.getDepartmentMark());
map.put("departmentname", departmentPO.getDepartmentName()); map.put("departmentname", departmentPO.getDepartmentName());
map.put("subcompanyid1", departmentPO.getSubCompanyId1()); map.put("subcompanyid1", Util.null2String(departmentPO.getSubCompanyId1()));
map.put("supdepid", departmentPO.getSupDepId()); map.put("supdepid", Util.null2String(departmentPO.getSupDepId()));
map.put("showorder", departmentPO.getShowOrder()); map.put("showorder", Util.null2String(departmentPO.getShowOrder()));
map.put("departmentcode", departmentPO.getDepartmentCode()); map.put("departmentcode", departmentPO.getDepartmentCode());
map.put("coadjutant", departmentPO.getCoadjutant()); map.put("coadjutant", Util.null2String(departmentPO.getCoadjutant()));
map.put("id", departmentPO.getId()); map.put("id", Util.null2String(departmentPO.getId()));
new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.UPDATE, map).sync(); new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.UPDATE, map).sync();
} }
@ -924,9 +906,9 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("departmentmark", departmentPO.getDepartmentMark()); map.put("departmentmark", departmentPO.getDepartmentMark());
map.put("departmentname", departmentPO.getDepartmentName()); map.put("departmentname", departmentPO.getDepartmentName());
map.put("subcompanyid1", departmentPO.getSubCompanyId1()); map.put("subcompanyid1", Util.null2String(departmentPO.getSubCompanyId1()));
map.put("supdepid", departmentPO.getSupDepId()); map.put("supdepid", Util.null2String(departmentPO.getSupDepId()));
map.put("showorder", departmentPO.getShowOrder()); map.put("showorder", Util.null2String(departmentPO.getShowOrder()));
map.put("departmentcode", departmentPO.getDepartmentCode()); map.put("departmentcode", departmentPO.getDepartmentCode());
return new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.ADD, map).sync(); return new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.ADD, map).sync();
} }
@ -961,8 +943,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
List<JobPO> jobPOS = getJobMapper().listJobsByDepartmentId(parentDepartment); List<JobPO> jobPOS = getJobMapper().listJobsByDepartmentId(parentDepartment);
jobPOS = jobPOS.stream().filter(item -> null == item.getParentJob() || 0 == item.getParentJob()).collect(Collectors.toList()); jobPOS = jobPOS.stream().filter(item -> null == item.getParentJob() || 0 == item.getParentJob()).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(jobPOS)) { if (CollectionUtils.isNotEmpty(jobPOS)) {
String ecCompanyId = EcHrmRelationUtil.getEcCompanyId(parentComp.toString()); getJobMapper().updateJobCompany(jobPOS.stream().map(JobPO::getId).collect(Collectors.toList()), parentComp, parentComp);
getJobMapper().updateJobCompany(jobPOS.stream().map(JobPO::getId).collect(Collectors.toList()), parentComp, ecCompanyId);
for (JobPO jobPO : jobPOS) { for (JobPO jobPO : jobPOS) {
// 刷新组织架构图 // 刷新组织架构图
new JobTriggerRunnable(jobPO.getId()).run(); new JobTriggerRunnable(jobPO.getId()).run();

@ -577,7 +577,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
private List<SearchTree> buildTreeByCompAndDept(DepartmentPO departmentBuild, CompanyPO compBuild, JobPO jobBuild) { private List<SearchTree> buildTreeByCompAndDept(DepartmentPO departmentBuild, CompanyPO compBuild, JobPO jobBuild) {
List<JobPO> jobPOS = getJobMapper().listPOsByFilter(jobBuild); List<JobPO> jobPOS = getJobMapper().listPOsByFilter(jobBuild);
new DetachUtil(user.getUID()).filterJobList(jobPOS); new DetachUtil(user.getUID()).filterJobList(jobPOS);
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild, "show_order"); List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild, "showorder");
new DetachUtil(user.getUID()).filterDepartmentList(filterDeparts); new DetachUtil(user.getUID()).filterDepartmentList(filterDeparts);
// 添加父级岗位 // 添加父级岗位
Set<JobPO> builderJobs = new HashSet<>(); Set<JobPO> builderJobs = new HashSet<>();
@ -607,7 +607,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
} }
// 查询分部信息 // 查询分部信息
List<CompanyPO> filterComps = getCompanyMapper().listByFilter(compBuild, "show_order"); List<CompanyPO> filterComps = getCompanyMapper().listByFilter(compBuild, "showorder");
new DetachUtil(user.getUID()).filterCompanyList(filterComps); new DetachUtil(user.getUID()).filterCompanyList(filterComps);
Set<DepartmentPO> builderDeparts = new HashSet<>(); Set<DepartmentPO> builderDeparts = new HashSet<>();
for (DepartmentPO departmentPO : filterDeparts) { for (DepartmentPO departmentPO : filterDeparts) {
@ -624,7 +624,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
filterComps.addAll(compsByIds); filterComps.addAll(compsByIds);
} }
} }
List<CompanyPO> allCompanys = getCompanyMapper().listAll("show_order"); List<CompanyPO> allCompanys = getCompanyMapper().listAll("showorder");
new DetachUtil(user.getUID()).filterCompanyList(allCompanys); new DetachUtil(user.getUID()).filterCompanyList(allCompanys);
Map<Integer, CompanyPO> allMaps = allCompanys.stream().collect(Collectors.toMap(CompanyPO::getId, item -> item, (k1, k2) -> k1)); Map<Integer, CompanyPO> allMaps = allCompanys.stream().collect(Collectors.toMap(CompanyPO::getId, item -> item, (k1, k2) -> k1));
Set<CompanyPO> builderComps = new HashSet<>(); Set<CompanyPO> builderComps = new HashSet<>();
@ -636,7 +636,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
private List<SearchTree> buildTreeByDeptAndJob(DepartmentPO departmentBuild, JobPO jobBuild) { private List<SearchTree> buildTreeByDeptAndJob(DepartmentPO departmentBuild, JobPO jobBuild) {
List<JobPO> jobPOS = getJobMapper().listPOsByFilter(jobBuild); List<JobPO> jobPOS = getJobMapper().listPOsByFilter(jobBuild);
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild, "show_order"); List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild, "showorder");
// 添加父级岗位 // 添加父级岗位
Set<JobPO> builderJobs = new HashSet<>(); Set<JobPO> builderJobs = new HashSet<>();
for (JobPO jobPO : jobPOS) { for (JobPO jobPO : jobPOS) {

@ -163,7 +163,7 @@ public class JobServiceImpl extends Service implements JobService {
JobPO jobPO = JobBO.convertParamsToPO(param, user.getUID()); JobPO jobPO = JobBO.convertParamsToPO(param, user.getUID());
boolean filter = isFilter(jobPO); boolean filter = isFilter(jobPO);
PageInfo<JobListDTO> pageInfos; PageInfo<JobListDTO> pageInfos;
String orderSql = PageInfoSortUtil.getSortSql(param.getSortParams()); String orderSql = PageInfoSortUtil.getSortSql(param.getSortParams(), " show_order ");
List<JobListDTO> allList = getJobMapper().listNoFilter(orderSql); List<JobListDTO> allList = getJobMapper().listNoFilter(orderSql);
new DetachUtil(user.getUID()).filterJobDTOList(allList); new DetachUtil(user.getUID()).filterJobDTOList(allList);
// 通过子级遍历父级元素 // 通过子级遍历父级元素
@ -631,7 +631,7 @@ public class JobServiceImpl extends Service implements JobService {
return; return;
} }
DepartmentPO parentDept = getDepartmentMapper().getDeptById(departmentPO.getSupDepId()); DepartmentPO parentDept = getDepartmentMapper().getDeptById(departmentPO.getSupDepId());
if (null != parentDept && 0 == parentDept.getCanceled()) { if (null != parentDept && (null == parentDept.getCanceled() || 0 == parentDept.getCanceled())) {
buildParentDepts(parentDept, builderDeparts); buildParentDepts(parentDept, builderDeparts);
} }
} }
@ -645,7 +645,7 @@ public class JobServiceImpl extends Service implements JobService {
private void buildParentComps(CompanyPO compPO, Set<CompanyPO> builderComps, Map<Integer, CompanyPO> allMaps) { private void buildParentComps(CompanyPO compPO, Set<CompanyPO> builderComps, Map<Integer, CompanyPO> allMaps) {
builderComps.add(compPO); builderComps.add(compPO);
CompanyPO parentComp = allMaps.get(compPO.getSupSubComId()); CompanyPO parentComp = allMaps.get(compPO.getSupSubComId());
if (null != parentComp && 0 == parentComp.getCanceled()) { if (null != parentComp && (null == parentComp.getCanceled() || 0 == parentComp.getCanceled())) {
buildParentComps(parentComp, builderComps, allMaps); buildParentComps(parentComp, builderComps, allMaps);
} }
} }
@ -669,7 +669,7 @@ public class JobServiceImpl extends Service implements JobService {
} else if (TYPE_DEPT.equals(type)) { } else if (TYPE_DEPT.equals(type)) {
// //
// 查询部门信息 // 查询部门信息
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(DepartmentPO.builder().departmentName(keyword).canceled(0).supDepId(Integer.parseInt(id)).build(), "show_order"); List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(DepartmentPO.builder().departmentName(keyword).canceled(0).supDepId(Integer.parseInt(id)).build(), "showorder");
Set<DepartmentPO> builderDeparts = new HashSet<>(); Set<DepartmentPO> builderDeparts = new HashSet<>();
for (DepartmentPO departmentPO : filterDeparts) { for (DepartmentPO departmentPO : filterDeparts) {
buildParentDepts(departmentPO, builderDeparts); buildParentDepts(departmentPO, builderDeparts);
@ -688,10 +688,10 @@ public class JobServiceImpl extends Service implements JobService {
* @return * @return
*/ */
private List<SearchTree> buildTreeByCompAndDept(DepartmentPO departmentBuild, CompanyPO compBuild) { private List<SearchTree> buildTreeByCompAndDept(DepartmentPO departmentBuild, CompanyPO compBuild) {
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild, "show_order"); List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild, "showorder");
new DetachUtil(user.getUID()).filterDepartmentList(filterDeparts); new DetachUtil(user.getUID()).filterDepartmentList(filterDeparts);
// 查询分部信息 // 查询分部信息
List<CompanyPO> filterComps = getCompanyMapper().listByFilter(compBuild, "show_order"); List<CompanyPO> filterComps = getCompanyMapper().listByFilter(compBuild, "showorder");
new DetachUtil(user.getUID()).filterCompanyList(filterComps); new DetachUtil(user.getUID()).filterCompanyList(filterComps);
Set<DepartmentPO> builderDeparts = new HashSet<>(); Set<DepartmentPO> builderDeparts = new HashSet<>();
for (DepartmentPO departmentPO : filterDeparts) { for (DepartmentPO departmentPO : filterDeparts) {
@ -706,7 +706,7 @@ public class JobServiceImpl extends Service implements JobService {
filterComps.addAll(compsByIds); filterComps.addAll(compsByIds);
} }
} }
List<CompanyPO> allCompanys = getCompanyMapper().listAll("show_order"); List<CompanyPO> allCompanys = getCompanyMapper().listAll("showorder");
new DetachUtil(user.getUID()).filterCompanyList(allCompanys); new DetachUtil(user.getUID()).filterCompanyList(allCompanys);
Map<Integer, CompanyPO> allMaps = allCompanys.stream().collect(Collectors.toMap(CompanyPO::getId, item -> item, (k1, k2) -> k1)); Map<Integer, CompanyPO> allMaps = allCompanys.stream().collect(Collectors.toMap(CompanyPO::getId, item -> item, (k1, k2) -> k1));
Set<CompanyPO> builderComps = new HashSet<>(); Set<CompanyPO> builderComps = new HashSet<>();

@ -20,7 +20,7 @@ public class PageInfoSortUtil {
* @param sortParams * @param sortParams
* @return * @return
*/ */
public static String getSortSql(String sortParams) { public static String getSortSql(String sortParams, String defaultOrder) {
JSONArray jsonArray = JSONObject.parseArray(sortParams); JSONArray jsonArray = JSONObject.parseArray(sortParams);
if (CollectionUtils.isNotEmpty(jsonArray)) { if (CollectionUtils.isNotEmpty(jsonArray)) {
JSONObject jsonObject = (JSONObject) jsonArray.get(0); JSONObject jsonObject = (JSONObject) jsonArray.get(0);
@ -28,7 +28,7 @@ public class PageInfoSortUtil {
String sortOrder = jsonObject.getString("sortOrder").replace("end", ""); String sortOrder = jsonObject.getString("sortOrder").replace("end", "");
return "t." + orderKey + " " + sortOrder; return "t." + orderKey + " " + sortOrder;
} }
return " showOrder "; return defaultOrder;
} }
/** /**

Loading…
Cancel
Save