Compare commits

...

22 Commits

Author SHA1 Message Date
dxfeng 46d8e99088 优化代码逻辑,去除map表交互,提升人员导入速度 8 months ago
dxfeng bbf8408bb4 组织透视图,岗位数据查询BUG修复 11 months ago
dxfeng 7d0c7282b8 组织透视图,岗位数据查询BUG修复 11 months ago
dxfeng 5822b37375 组织透视图,穿透BUG修复 11 months ago
dxfeng 707aa00417 岗位列表树,展示顺序问题处理 11 months ago
dxfeng 16a23e9e39 晶优组织架构图重写 12 months ago
dxfeng 8d9303f07c 晶优组织架构图重写 12 months ago
dxfeng 28884f06a9 晶优组织架构图重写 12 months ago
dxfeng ffc9a89cd1 晶优二开,编制信息导出 2 years ago
dxfeng 31436b195e 晶优二开,编制信息导出 2 years ago
dxfeng 0f84ffa2e0 晶优二开,编制信息导出 2 years ago
dxfeng 33c02ec78e 组织架构图、集团负责人展示 3 years ago
dxfeng 1a47555a80 组织架构图搜索BUG修复 3 years ago
dxfeng ab61cde4a7 组织架构图编制、在岗数据刷新 3 years ago
dxfeng c3e73c2b44 独立项目分支。由dev分支回退、BUG修复 3 years ago
dxfeng 5715a02a47 独立项目分支。由dev分支回退、BUG修复 3 years ago
dxfeng 47b8f651a9 Merge branch 'develop' of http://221.226.25.34:3000/liang.cheng/weaver-hrm-organization into feature/jingyou 3 years ago
liang.cheng 89554625ca Merge pull request 'develop' (#20) from develop into master
Reviewed-on: #20
3 years ago
reset 44f71e8bee
!225 fixed
Merge pull request !225 from reset/feature/cl
3 years ago
reset e323d12394
!217 bug修复
Merge pull request !217 from reset/feature/cl
3 years ago
Chengliang 31ab137195 修复组织架构图跳转问题 3 years ago
reset 6ad63f5d43
!200 生产合并
Merge pull request !200 from reset/develop
3 years ago

@ -0,0 +1,63 @@
<%@ page import="com.engine.organization.thread.CompanyTriggerRunnable" %>
<%@ page import="com.engine.organization.thread.DepartmentTriggerRunnable" %>
<%@ page import="com.engine.organization.thread.JobTriggerRunnable" %>
<%@ page import="org.apache.commons.lang3.StringUtils" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="java.util.HashSet" %>
<%@ page import="java.util.Set" %>
<%@ page import="com.engine.organization.util.db.MapperProxyFactory" %>
<%@ page import="com.engine.organization.mapper.job.JobMapper" %>
<%@ page import="com.engine.organization.entity.job.po.JobPO" %>
<%@ page import="com.engine.organization.entity.department.po.DepartmentPO" %>
<%@ page import="com.engine.organization.mapper.department.DepartmentMapper" %>
<%@ page import="com.engine.organization.mapper.comp.CompMapper" %>
<%@ page import="com.engine.organization.entity.company.po.CompPO" %>
<%@ page import="com.engine.organization.initdata.RefreshPlan" %>
<%@ page contentType="text/html; charset=UTF-8" %>
<%
RecordSet rs = new RecordSet();
// 刷新岗位
Set<Long> jobSet = new HashSet<>();
Set<Long> departmentSet = new HashSet<>();
Set<Long> companySet = new HashSet<>();
rs.executeQuery("select id, parent_job from jcl_org_job where id not in( select ifnull(parent_job, '') from jcl_org_job where delete_type =0 and forbidden_tag=0) and delete_type =0 and forbidden_tag=0");
while (rs.next()) {
Long jobId = Long.parseLong(Util.null2String(rs.getString("id")));
JobPO jobPO = MapperProxyFactory.getProxy(JobMapper.class).getJobById(jobId);
RefreshPlan.updateResourceJob(jobId);
new JobTriggerRunnable(jobPO, jobPO).run();
String parentJobId = Util.null2String(rs.getString("parent_job"));
if (StringUtils.isNotBlank(parentJobId)) {
RefreshPlan.refreshJob(Long.parseLong(parentJobId), jobSet);
}
}
// 刷新部门
rs.executeQuery("select id, parent_dept from jcl_org_dept where id not in( select ifnull(parent_dept , '') from jcl_org_dept where delete_type =0 and forbidden_tag=0) and delete_type =0 and forbidden_tag=0");
while (rs.next()) {
Long departmentId = Long.parseLong(Util.null2String(rs.getString("id")));
DepartmentPO deptById = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptById(departmentId);
new DepartmentTriggerRunnable(deptById, deptById).run();
String parentDepartmentId = Util.null2String(rs.getString("parent_dept"));
if (StringUtils.isNotBlank(parentDepartmentId)) {
RefreshPlan.refreshDepartment(Long.parseLong(parentDepartmentId), departmentSet);
}
}
// 刷新分部
rs.executeQuery("select id, parent_company from jcl_org_comp where id not in( select ifnull(parent_company , '') from jcl_org_comp where delete_type =0 and forbidden_tag=0) and delete_type =0 and forbidden_tag=0");
while (rs.next()) {
Long companyId = Long.parseLong(Util.null2String(rs.getString("id")));
CompPO compPO = MapperProxyFactory.getProxy(CompMapper.class).listById(companyId);
new CompanyTriggerRunnable(compPO, compPO).run();
String parentCompanyId = Util.null2String(rs.getString("parent_company"));
if (StringUtils.isNotBlank(parentCompanyId)) {
RefreshPlan.refreshCompany(Long.parseLong(parentCompanyId), companySet);
}
}
out.println("数据刷新完成");
%>

@ -19,15 +19,12 @@ import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.util.OrganizationFormItemUtil;
import com.engine.organization.util.db.DBType;
import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.detach.DetachUtil;
import com.engine.organization.util.tree.SearchTreeUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.Util;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author:dxfeng
@ -127,11 +124,6 @@ public class JobBrowserService extends BrowserService {
}
}
}
// 分权
DetachUtil detachUtil = new DetachUtil(user.getUID());
if (detachUtil.isDETACH()) {
sqlWhere += " AND t.parent_comp in (" + detachUtil.getJclRoleLevels() + ")";
}
return sqlWhere;
}
@ -143,59 +135,26 @@ public class JobBrowserService extends BrowserService {
*/
private List<TreeNode> getCurrentTreeNode(SearchTreeParams params) {
// 分权
DetachUtil detachUtil = new DetachUtil(user.getUID());
List<Long> jclRoleLevelList;
if (StringUtils.isNotBlank(detachUtil.getJclRoleLevels())) {
jclRoleLevelList = Arrays.stream(detachUtil.getJclRoleLevels().split(",")).map(Long::parseLong).collect(Collectors.toList());
}else{
jclRoleLevelList = new ArrayList<>();
}
List<TreeNode> treeNodes = new ArrayList<>();
if (StringUtils.isBlank(params.getId())) {
// 集团总部
SearchTree topGroup = SearchTreeUtil.getTopGroup();
if(detachUtil.isDETACH()&& StringUtils.isNotBlank(detachUtil.getJclRoleLevels())) {
topGroup.setIsParent(true);
}else{
topGroup.setIsParent(false);
}
topGroup.setIsParent(true);
treeNodes.add(topGroup);
} else {
// 分部存在下级的ID
List<String> compHasSubs;
if (detachUtil.isDETACH()) {
if(CollectionUtils.isNotEmpty(jclRoleLevelList)) {
compHasSubs = MapperProxyFactory.getProxy(CompMapper.class).hasDetachSubs(jclRoleLevelList);
}else{
compHasSubs = new ArrayList<>();
}
} else {
compHasSubs = MapperProxyFactory.getProxy(CompMapper.class).hasSubs();
}
List<String> compHasSubs = MapperProxyFactory.getProxy(CompMapper.class).hasSubs();
// 部门存在下级的ID
List<String> hasSubDepartment = MapperProxyFactory.getProxy(DepartmentMapper.class).hasSubs();
if ("0".equals(params.getId())) {
List<CompPO> compList;
if (detachUtil.isDETACH()) {
if(CollectionUtils.isNotEmpty(jclRoleLevelList)) {
compList = MapperProxyFactory.getProxy(CompMapper.class).getCompsByIds(jclRoleLevelList);
detachUtil.filterCompanyList(compList);
}else{
compList = new ArrayList<>();
}
}else{
compList = MapperProxyFactory.getProxy(CompMapper.class).listParent();
}
List<CompPO> compList = MapperProxyFactory.getProxy(CompMapper.class).listParent();
// 获取顶层分部
compList.stream().sorted(Comparator.comparing(CompPO::getShowOrder)).forEach(item -> buildCompNodes(treeNodes, compHasSubs, item));
} else if ("1".equals(params.getType())) {
// 当前节点下的元素
CompPO compBuild = CompPO.builder().parentCompany(Long.parseLong(params.getId())).forbiddenTag(0).deleteType(0).build();
List<CompPO> compList = MapperProxyFactory.getProxy(CompMapper.class).listByFilter(compBuild, "show_order");
if (detachUtil.isDETACH()) {
detachUtil.filterCompanyList(compList);
}
DepartmentPO departmentBuild = DepartmentPO.builder().parentComp(Long.parseLong(params.getId())).forbiddenTag(0).deleteType(0).build();
List<DepartmentPO> departmentList = MapperProxyFactory.getProxy(DepartmentMapper.class).listByFilter(departmentBuild, "show_order");
compList.forEach(item -> buildCompNodes(treeNodes, compHasSubs, item));

@ -1,12 +0,0 @@
package com.api.organization.web;
import javax.ws.rs.Path;
/**
* @author:dxfeng
* @createTime: 2022/06/21
* @version: 1.0
*/
@Path("/bs/hrmorganization/hrmresource")
public class HrmResourceController extends com.engine.organization.web.HrmResourceController{
}

@ -1,13 +0,0 @@
package com.api.organization.web;
import javax.ws.rs.Path;
/**
* @Author weaver_cl
* @Description:
* @Date 2022/10/21
* @Version V1.0
**/
@Path("/bs/hrmorganization/detach")
public class ManagerDetachController extends com.engine.organization.web.ManagerDetachController {
}

@ -1,12 +0,0 @@
package com.api.organization.web;
import javax.ws.rs.Path;
/**
* @author:dxfeng
* @createTime: 2022/10/09
* @version: 1.0
*/
@Path("/bs/hrmorganization/personnelcard")
public class PersonnelCardController extends com.engine.organization.web.PersonnelCardController {
}

@ -0,0 +1,66 @@
package com.engine.organization.entity.cusfielddata.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author:dxfeng
* @createTime: 2022/08/01
* @version: 1.0
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class CusFieldData {
private Integer seqOrder;
private String scope;
private Long scopeId;
private Long id;
/**
*
*/
private String field100001;
/**
* id
*/
private String field100002;
/**
* id
*/
private String field100003;
/**
* 线
*/
private String field100004;
/**
*
*/
private String field100005;
/**
*
*/
private String field100006;
/**
*
*/
private String field100007;
/**
*
*/
private String field100008;
/**
*
*/
private String field100009;
/**
*
*/
private String field100010;
private String field100011;
private String field100012;
private String field100013;
private String field100014;
}

@ -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;

@ -1,338 +0,0 @@
package com.engine.organization.entity.hrmresource.param;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @author:dxfeng
* @createTime: 2022/06/27
* @version: 1.0
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class HrmResourceImportParam {
/**
* id
*/
private Long id;
/**
* work_code
*/
private String work_code;
/**
* login_id
*/
private String login_id;
/**
* last_name
*/
private String last_name;
/**
* sex
*/
private String sex;
/**
* account_type
*/
private String account_type;
/**
* belong_to
*/
private String belong_to;
/**
* company_id
*/
private String company_id;
/**
* department_id
*/
private String department_id;
/**
* job_activity
*/
private String job_activity;
/**
* job_title
*/
private String job_title;
/**
* job_call
*/
private String job_call;
/**
* job_level
*/
private String job_level;
/**
* job_group_id
*/
private String job_group_id;
/**
* job_activity_desc
*/
private String job_activity_desc;
/**
* status
*/
private String status;
/**
* system_language
*/
private String system_language;
/**
* resource_image_id
*/
private String resource_image_id;
/**
* messager_url
*/
private String messager_url;
/**
* location_id
*/
private String location_id;
/**
* manager_id
*/
private String manager_id;
/**
* assistant_id
*/
private String assistant_id;
/**
* mobile
*/
private String mobile;
/**
* telephone
*/
private String telephone;
/**
* mobile_call
*/
private String mobile_call;
/**
* fax
*/
private String fax;
/**
* email
*/
private String email;
/**
* workroom
*/
private String workroom;
/**
* pass_word
*/
private String pass_word;
/**
* sec_level
*/
private String sec_level;
/**
* birthday
*/
private String birthday;
/**
* folk
*/
private String folk;
/**
* native_place
*/
private String native_place;
/**
* reg_resident_place
*/
private String reg_resident_place;
/**
* certificate_num
*/
private String certificate_num;
/**
* marital_status
*/
private String marital_status;
/**
* policy
*/
private String policy;
/**
* be_member_date
*/
private String be_member_date;
/**
* be_party_date
*/
private String be_party_date;
/**
* islabouunion
*/
private String islabouunion;
/**
* degree
*/
private String degree;
/**
* health_info
*/
private String health_info;
/**
* education_level
*/
private String education_level;
/**
* height
*/
private String height;
/**
* weight
*/
private Integer weight;
/**
* use_kind
*/
private String use_kind;
/**
* start_date
*/
private String start_date;
/**
* end_date
*/
private String end_date;
/**
* probation_end_date
*/
private String probation_end_date;
/**
* resident_place
*/
private String resident_place;
/**
* home_address
*/
private String home_address;
/**
* temp_resident_number
*/
private String temp_resident_number;
/**
* company_start_date
*/
private String company_start_date;
/**
* work_start_date
*/
private String work_start_date;
/**
* accum_fund_account
*/
private String accum_fund_account;
/**
* account_name
*/
private String account_name;
/**
* bank_id
*/
private String bank_id;
/**
* account_id
*/
private String account_id;
/**
* show_order
*/
private Integer show_order;
/**
* classification
*/
private String classification;
/**
* woprk_year
*/
private String work_year;
/**
* company_work_year
*/
private String company_work_year;
private String baseFieldsValue;
private String baseFields;
private Long creator;
private int deleteType;
private Date createTime;
private Date updateTime;
}

@ -1,151 +0,0 @@
package com.engine.organization.entity.hrmresource.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @author:dxfeng
* @createTime: 2022/06/21
* @version: 1.0
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class HrmResourcePO {
/**
* id
*/
private Long id;
/**
*
*/
private String workCode;
/**
*
*/
private String lastName;
/**
*
*/
private String sex;
/**
*
*/
private Integer accountType;
/**
*
*/
private Long belongTo;
/**
*
*/
private Long departmentId;
/**
*
*/
private Long companyId;
/**
*
*/
private Long jobActivity;
/**
*
*/
private Long jobTitle;
/**
*
*/
private String jobLevel;
/**
*
*/
private Long jobGroupId;
/**
*
*/
private String jobActivityDesc;
/**
*
*/
private Integer status;
/**
*
*/
private String resourceImageId;
/**
*
*/
private Integer locationId;
/**
*
*/
private String mobile;
/**
*
*/
private String telephone;
/**
*
*/
private String email;
private Long creator;
private int deleteType;
private Date createTime;
private Date updateTime;
/**
*
*/
private String companyStartDate;
/**
*
*/
private String workStartDate;
/**
*
*/
private Integer showOrder;
private Long ecDepartment;
private Long ecCompany;
private String uuid;
private String jobGrade;
private String schemeId;
private String sequenceId;
private String baseFieldsValue;
private String baseFields;
}

@ -0,0 +1,219 @@
package com.engine.organization.entity.jingyou;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import java.util.Objects;
/**
* @author:dxfeng
* @createTime: 2024/07/19
* @version: 1.0
*/
public class JyChart {
private String id;
private String fname;
private String ftype;
private String parentId;
private String fnumber;
private String fobjid;
private String fecid;
private String fisvitual;
private String expand;
private String uuid;
private boolean hasChildren;
private String fleadername;
private String fleaderimg;
private String fleaderjob;
private String fleader;
private String fplan;
private String fonjob;
private String fleaderlv;
private String fleaderst;
protected static final RecordSet rs = new RecordSet();
// 提供静态方法来获取 RecordSet 实例
public static RecordSet getRecordSet() {
return rs;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getFname() {
return fname;
}
public void setFname(String fname) {
this.fname = fname;
}
public String getFtype() {
return ftype;
}
public void setFtype(String ftype) {
this.ftype = ftype;
}
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public String getFnumber() {
return fnumber;
}
public void setFnumber(String fnumber) {
this.fnumber = fnumber;
}
public String getFobjid() {
// 根据UUID获取聚才林ID
if (StringUtils.isNotBlank(uuid)) {
if (id.startsWith("s_")) {
// 查询聚才林分部的ID
rs.executeQuery("select id from jcl_org_comp where uuid = ?",uuid);
if(rs.next()){
return rs.getString("id");
}
} else if (id.startsWith("d_")) {
// 查询聚才林分部的ID
rs.executeQuery("select id from jcl_org_dept where uuid = ?",uuid);
if(rs.next()){
return rs.getString("id");
}
}
}
return fobjid;
}
public void setFobjid(String fobjid) {
this.fobjid = fobjid;
}
public String getFecid() {
return fecid;
}
public void setFecid(String fecid) {
this.fecid = fecid;
}
public String getFisvitual() {
return fisvitual;
}
public void setFisvitual(String fisvitual) {
this.fisvitual = fisvitual;
}
public String getExpand() {
return expand;
}
public void setExpand(String expand) {
this.expand = expand;
}
public boolean isHasChildren() {
// 都置为true
return true;
}
public void setHasChildren(boolean hasChildren) {
this.hasChildren = hasChildren;
}
public String getFleadername() {
return fleadername;
}
public void setFleadername(String fleadername) {
this.fleadername = fleadername;
}
public String getFleaderimg() {
return fleaderimg;
}
public void setFleaderimg(String fleaderimg) {
this.fleaderimg = fleaderimg;
}
public String getFleaderjob() {
return fleaderjob;
}
public void setFleaderjob(String fleaderjob) {
this.fleaderjob = fleaderjob;
}
public String getFleader() {
return fleader;
}
public void setFleader(String fleader) {
this.fleader = fleader;
}
public String getFplan() {
return fplan;
}
public void setFplan(String fplan) {
this.fplan = fplan;
}
public String getFonjob() {
return fonjob;
}
public void setFonjob(String fonjob) {
this.fonjob = fonjob;
}
public String getFleaderlv() {
return fleaderlv;
}
public void setFleaderlv(String fleaderlv) {
this.fleaderlv = fleaderlv;
}
public String getFleaderst() {
return fleaderst;
}
public void setFleaderst(String fleaderst) {
this.fleaderst = fleaderst;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
JyChart jyChart = (JyChart) o;
return id.equals(jyChart.id);
}
@Override
public int hashCode() {
return Objects.hash(id);
}
}

@ -0,0 +1,49 @@
package com.engine.organization.entity.jingyou;
import cn.hutool.core.convert.Convert;
import weaver.conn.RecordSet;
/**
* @author:dxfeng
* @createTime: 2024/07/19
* @version: 1.0
*/
public class JyCompanyChart extends JyChart {
@Override
public String getFleadername() {
return "";
}
@Override
public String getFplan() {
RecordSet rs = getRecordSet();
rs.executeQuery("select sum(staff_num) as num from jcl_org_staff and delete_type = 0 ");
if(rs.next()){
return String.valueOf(Convert.toInt(rs.getString("num"),0));
}
return "0";
}
@Override
public String getFonjob() {
RecordSet rs = getRecordSet();
// 查询在岗数
rs.executeQuery("select count(id) as fonjob from hrmresource where status <4 ");
if(rs.next()){
return rs.getString("fonjob");
}
return "0";
}
@Override
public boolean equals(Object o) {
return super.equals(o);
}
@Override
public int hashCode() {
return super.hashCode();
}
}

@ -0,0 +1,65 @@
package com.engine.organization.entity.jingyou;
import cn.hutool.core.convert.Convert;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.hrm.company.DepartmentComInfo;
import java.util.ArrayList;
/**
* @author:dxfeng
* @createTime: 2024/07/19
* @version: 1.0
*/
public class JyDepartmentChart extends JyChart {
@Override
public String getFplan() {
RecordSet rs = getRecordSet();
String fecid = super.getFecid();
ArrayList<String> ids = new ArrayList<>();
new DepartmentComInfo().getAllChildDeptByDepId(ids,fecid);
ids.add(fecid);
String idsStr = StringUtils.join(ids, ",");
rs.executeQuery("select sum(staff_num) as num from jcl_org_staff where dept_id in(" + idsStr + ") and delete_type = 0 ");
if (rs.next()) {
return String.valueOf(Convert.toInt(rs.getString("num"),0));
}
return "0";
}
@Override
public String getFonjob() {
RecordSet rs = getRecordSet();
String fecid = super.getFecid();
if (StringUtils.isNotBlank(fecid)) {
ArrayList<String> ids = new ArrayList<>();
new DepartmentComInfo().getAllChildDeptByDepId(ids,fecid);
ids.add(fecid);
String idsStr = StringUtils.join(ids, ",");
// 查询在岗数
rs.executeQuery("select count(id) as fonjob from hrmresource where status <4 and departmentid in (" + idsStr + ")");
if (rs.next()) {
return rs.getString("fonjob");
}
}
return "0";
}
@Override
public String getFleadername() {
return "";
}
@Override
public boolean equals(Object o) {
return super.equals(o);
}
@Override
public int hashCode() {
return super.hashCode();
}
}

@ -0,0 +1,52 @@
package com.engine.organization.entity.jingyou;
import cn.hutool.core.convert.Convert;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
/**
* @author:dxfeng
* @createTime: 2024/07/19
* @version: 1.0
*/
public class JyJobChart extends JyChart {
@Override
public String getFplan() {
RecordSet rs = getRecordSet();
rs.executeQuery("select sum(staff_num) as num from jcl_org_staff where job_id = ? and delete_type = 0 ",getFecid());
if(rs.next()){
return String.valueOf(Convert.toInt(rs.getString("num"),0));
}
return "0";
}
@Override
public String getFonjob() {
RecordSet rs = getRecordSet();
String fecid = super.getFecid();
if (StringUtils.isNotBlank(fecid)) {
// 查询在岗数
rs.executeQuery("select count(a.id) as fonjob from hrmresource a inner join cus_fielddata b on a.id = b.id and b.scope ='hrmcustomfieldbyinfotype' and b.scopeid ='-1' where a.status <4 and b.field100002 = ?", fecid);
if (rs.next()) {
return rs.getString("fonjob");
}
}
return "0";
}
@Override
public String getFobjid() {
return super.getFecid();
}
@Override
public boolean equals(Object o) {
return super.equals(o);
}
@Override
public int hashCode() {
return super.hashCode();
}
}

@ -0,0 +1,50 @@
package com.engine.organization.entity.jingyou;
/**
* @author:dxfeng
* @createTime: 2024/07/19
* @version: 1.0
*/
public class JyOrgSelectItem {
private String id;
private String fnumber;
private String fname;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getFnumber() {
return fnumber;
}
public void setFnumber(String fnumber) {
this.fnumber = fnumber;
}
public String getFname() {
return fname;
}
public void setFname(String fname) {
this.fname = fname;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof JyOrgSelectItem) {
JyOrgSelectItem item = (JyOrgSelectItem) obj;
return this.getId().equals(item.getId());
}
return false;
}
@Override
public int hashCode() {
return this.getId().hashCode();
}
}

@ -0,0 +1,38 @@
package com.engine.organization.entity.jingyou;
import com.engine.organization.service.impl.JyChartServiceImpl;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
/**
* @author:dxfeng
* @createTime: 2024/07/19
* @version: 1.0
*/
public class JyResourceChart extends JyChart {
@Override
public String getFleaderjob() {
String parentId = getParentId();
if (StringUtils.isNotBlank(parentId)) {
String chartId = JyChartServiceImpl.getChartId(parentId);
if (StringUtils.isNotBlank(chartId)) {
RecordSet rs = getRecordSet();
rs.executeQuery("select job_name from jcl_org_job where id = ?", chartId);
if (rs.next()) {
return rs.getString("job_name");
}
}
}
return "";
}
@Override
public boolean equals(Object o) {
return super.equals(o);
}
@Override
public int hashCode() {
return super.hashCode();
}
}

@ -0,0 +1,66 @@
package com.engine.organization.entity.jingyou;
import cn.hutool.core.convert.Convert;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.hrm.company.SubCompanyComInfo;
import java.util.ArrayList;
/**
* @author:dxfeng
* @createTime: 2024/07/19
* @version: 1.0
*/
public class JySubCompanyChart extends JyChart {
@Override
public String getFplan() {
RecordSet rs = getRecordSet();
ArrayList<String> ids = new ArrayList<>();
String fecid = super.getFecid();
new SubCompanyComInfo().getSubCompanyLists(fecid, ids);
ids.add(fecid);
String idsStr = StringUtils.join(ids, ",");
rs.executeQuery("select sum(staff_num) as num from jcl_org_staff where comp_id in(" + idsStr + ") and delete_type = 0 ");
if (rs.next()) {
return String.valueOf(Convert.toInt(rs.getString("num"),0));
}
return "0";
}
@Override
public String getFonjob() {
String fecid = super.getFecid();
if (StringUtils.isNotBlank(fecid)) {
RecordSet rs = getRecordSet();
ArrayList<String> ids = new ArrayList<>();
new SubCompanyComInfo().getSubCompanyLists(fecid,ids);
ids.add(fecid);
String idsStr = StringUtils.join(ids, ",");
// 查询在岗数
rs.executeQuery("select count(id) as fonjob from hrmresource where status <4 and subcompanyid1 in (" + idsStr + ")");
if (rs.next()) {
return rs.getString("fonjob");
}
}
return "0";
}
@Override
public String getFleadername() {
return "";
}
@Override
public boolean equals(Object o) {
return super.equals(o);
}
@Override
public int hashCode() {
return super.hashCode();
}
}

@ -152,7 +152,7 @@ public class JobBO {
SearchTree tree = new SearchTree();
tree.setCanClick(true);
tree.setCanceled(false);
tree.setIcon("icon-coms-Branch");
tree.setIcon("icon-coms-content-o");
tree.setId(item.getId().toString());
tree.setIsParent(false);
tree.setIsVirtual("0");

@ -39,7 +39,7 @@ public class JobListDTO {
/**
*
*/
@TableTitle(title = "编号", dataIndex = "jobNo", key = "jobNo")
@TableTitle(title = "编号", dataIndex = "jobNo", key = "jobNo", sorter = true)
private String jobNo;
/**
*

@ -0,0 +1,89 @@
package com.engine.organization.entity.staff.po;
import com.engine.organization.transmethod.*;
import lombok.Data;
import org.apache.commons.lang.StringUtils;
/**
* @author:dxfeng
* @createTime: 2023/03/13
* @version: 1.0
*/
@Data
public class StaffExportPO {
/**
* id
*/
private String planId;
/**
*
*/
private String compId;
/**
*
*/
private String deptId;
/**
*
*/
private String jobId;
/**
*
*/
private Integer staffNum;
/**
*
*/
private Integer permanentNum;
/**
*
*/
private Integer freezeNum;
/**
*
*/
private String lackStatus;
/**
*
*/
private String staffDesc;
public String getPlanId() {
return StringUtils.isBlank(planId) ? "" : StaffPlanTransMethod.getSpanById(planId);
}
public String getCompId() {
return StringUtils.isBlank(compId) ? "" : CompTransMethod.getSpanById(compId);
}
public String getDeptId() {
return StringUtils.isBlank(deptId) ? "" : DepartmentTransMethod.getSpanById(deptId);
}
public String getJobId() {
return StringUtils.isBlank(jobId) ? "" : JobTransMethod.getSpanById(jobId);
}
public Integer getStaffNum() {
return staffNum;
}
public Integer getPermanentNum() {
return permanentNum;
}
public Integer getFreezeNum() {
return freezeNum;
}
public String getLackStatus() {
return StringUtils.isBlank(lackStatus) ? "" : StaffTransMethod.getLackSpan(lackStatus);
}
public String getStaffDesc() {
return StringUtils.isBlank(staffDesc) ? "" : staffDesc;
}
}

@ -0,0 +1,87 @@
package com.engine.organization.initdata;
import com.engine.organization.entity.company.po.CompPO;
import com.engine.organization.entity.department.po.DepartmentPO;
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.job.JobMapper;
import com.engine.organization.thread.CompanyTriggerRunnable;
import com.engine.organization.thread.DepartmentTriggerRunnable;
import com.engine.organization.thread.HrmResourceTriggerRunnable;
import com.engine.organization.thread.JobTriggerRunnable;
import com.engine.organization.util.db.MapperProxyFactory;
import weaver.conn.RecordSet;
import java.util.Set;
/**
* @author:dxfeng
* @createTime: 2022/11/07
* @version: 1.0
*/
public class RefreshPlan {
private static JobMapper getJobMapper() {
return MapperProxyFactory.getProxy(JobMapper.class);
}
private static CompMapper getCompMapper() {
return MapperProxyFactory.getProxy(CompMapper.class);
}
private static DepartmentMapper getDepartmentMapper() {
return MapperProxyFactory.getProxy(DepartmentMapper.class);
}
// 递归刷新岗位
public static void refreshJob(Long parentJobId, Set<Long> jobSet) {
if (null == parentJobId || jobSet.contains(parentJobId)) {
return;
}
// 获取父级岗位、同步数据
JobPO jobById = getJobMapper().getJobById(parentJobId);
if (null != jobById) {
updateResourceJob(parentJobId);
new JobTriggerRunnable(jobById, jobById).run();
refreshJob(jobById.getParentJob(), jobSet);
}
jobSet.add(parentJobId);
}
// 递归刷新部门
public static void refreshDepartment(Long parentDepartmentId, Set<Long> departmentSet) {
if (null == parentDepartmentId || departmentSet.contains(parentDepartmentId)) {
return;
}
// 获取父级岗位、同步数据
DepartmentPO deptById = getDepartmentMapper().getDeptById(parentDepartmentId);
if (null != deptById) {
new DepartmentTriggerRunnable(deptById, deptById).run();
refreshDepartment(deptById.getParentDept(), departmentSet);
}
departmentSet.add(parentDepartmentId);
}
public static void refreshCompany(Long parentCompanyId, Set<Long> companySet) {
if (null == parentCompanyId || companySet.contains(parentCompanyId)) {
return;
}
// 获取父级分部、同步数据
CompPO compPO = getCompMapper().listById(parentCompanyId);
if (null != compPO) {
new CompanyTriggerRunnable(compPO, compPO).run();
refreshCompany(compPO.getParentCompany(), companySet);
}
companySet.add(parentCompanyId);
}
public static void updateResourceJob(Long jobId) {
RecordSet rs = new RecordSet();
rs.executeQuery("select id from cus_fielddata where scope = 'hrmcustomfieldbyinfotype' and scopeid = -1 and field100002 = ?", jobId);
while (rs.next()) {
Long resourceId = Long.parseLong(rs.getString("id"));
new HrmResourceTriggerRunnable(resourceId).run();
}
}
}

@ -399,10 +399,6 @@
select company_id
from JCL_ORG_STAFFPLAN
where delete_type = 0
union
select jcl_rolelevel
from jcl_org_detach
where delete_type = 0
</select>
<select id="getCompanyByUUID" resultMap="BaseResultMap">
SELECT

@ -1,7 +1,10 @@
package com.engine.organization.mapper.hrmresource;
import com.engine.organization.entity.hrmresource.vo.HrmResourceVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @description:
* @author:dxfeng
@ -10,16 +13,6 @@ import org.apache.ibatis.annotations.Param;
*/
public interface HrmResourceMapper {
/**
* ID
*
* @return
*/
Long getMaxId();
Long getMaxShowOrder();
/**
* ID
*
@ -28,24 +21,7 @@ public interface HrmResourceMapper {
*/
String getLastNameById(@Param("id") Long id);
/**
* ID
*
* @param keyField
* @param keyFieldValue
* @return
*/
Long getIdByKeyField(@Param("keyField") String keyField, @Param("keyFieldValue") String keyFieldValue);
///**
// * 根据所选关键字段,查询关键列
// *
// * @param keyField
// * @return
// */
//List<JSONObject> getKeyMapByKetField(@Param("keyField") String keyField);
List<HrmResourceVO> listAll(@Param("ids") List<Long> ids);
String getEcResourceId(@Param("jclResourceId") String jclResourceId);
Long getJclResourceId(@Param("ecResourceId") String ecResourceId);
}

@ -2,60 +2,20 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.engine.organization.mapper.hrmresource.HrmResourceMapper">
<resultMap id="BaseResultMap" type="com.engine.organization.entity.hrmresource.po.HrmResourcePO">
<result column="id" property="id"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t
.
id
, t.creator
, t.delete_type
, t.create_time
, t.update_time
</sql>
<select id="getMaxId" resultType="java.lang.Long">
select max(id)
from jcl_org_hrmresource
</select>
<select id="getLastNameById" resultType="java.lang.String">
select last_name
from jcl_org_hrmresource
where delete_type = 0
and id = #{id}
</select>
<select id="getIdByKeyField" resultType="java.lang.Long">
select id
from jcl_org_hrmresource
where delete_type = 0
and ${keyField} = #{keyFieldValue}
</select>
<select id="getEcResourceId" resultType="java.lang.String">
select a.id
from hrmresource a
inner join jcl_org_hrmresource b on a.uuid = b.uuid
where b.id = #{jclResourceId}
</select>
<select id="getJclResourceId" resultType="java.lang.Long">
select a.id
from jcl_org_hrmresource a
inner join hrmresource b on a.uuid = b.uuid
where b.id = #{ecResourceId}
from hrmresource
where id = #{id}
</select>
<select id="getMaxShowOrder" resultType="java.lang.Long">
select max(show_order)
from jcl_org_hrmresource
<select id="listAll" resultType="com.engine.organization.entity.hrmresource.vo.HrmResourceVO">
select t.lastname as lastname, d.departmentname as departmentname, c.subcompanyname as companyname, t.mobile,
t.telephone, t1.lastname as managername from hrmresource t left join hrmdepartment d on t.departmentid = d.id
left join hrmsubcompany c on t.subcompanyid1 = c.id left join hrmresource t1 on t.managerid = t1.id where 1 = 1
<if test="ids != null and ids.size > 0">
AND t.id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
</select>
<!-- <select id="getKeyMapByKetField" resultType="com.alibaba.fastjson.JSONObject">-->
<!-- select id, account_type, certificate_num, login_id, work_code, ${keyField}-->
<!-- from jcl_org_hrmresource-->
<!-- </select>-->
</mapper>

@ -2,6 +2,7 @@ package com.engine.organization.mapper.hrmresource;
import com.engine.organization.entity.commom.RecordInfo;
import com.engine.organization.entity.cusfielddata.po.CusFieldData;
import com.engine.organization.entity.jclimport.po.CusFormFieldPO;
import com.engine.organization.entity.jclimport.po.JclSelectItem;
import org.apache.ibatis.annotations.Param;
@ -61,4 +62,10 @@ public interface SystemDataMapper {
List<String> getBatchUuidByIds(@Param("tableName") String tableName,@Param("ecIds") List<String> ecIds);
CusFieldData getHrmCusFieldDataByIdAndScopeId(@Param("id") Long id, @Param("scopeId") Long scopeId);
int insertCusFieldData(CusFieldData cusFieldData);
int updateCusFieldData(CusFieldData cusFieldData);
}

@ -154,9 +154,11 @@
from hrmresource
</select>
<select id="getHrmResourceIdsByDept" resultType="java.lang.Long">
select id
from jcl_org_hrmresource
where department_id = #{departmentId}
select a.id
from hrmresource a
inner join hrmdepartment b on a.DEPARTMENTID = b.id
inner join jcl_org_dept c on b.uuid = c.uuid
where c.id = #{departmentId}
</select>
<select id="getBatchUuidByIds" resultType="java.lang.String">
@ -166,5 +168,36 @@
</foreach>
</select>
<select id="getHrmCusFieldDataByIdAndScopeId"
resultType="com.engine.organization.entity.cusfielddata.po.CusFieldData">
select *
from cus_fielddata
where scope = 'HrmCustomFieldByInfoType'
and scopeid = #{scopeId}
and id = #{id}
</select>
<update id="updateCusFieldData">
update cus_fielddata
<set>
field100001=#{field100001},
field100002=#{field100002},
field100003=#{field100003},
field100008=#{field100008},
field100006=#{field100006},
field100007=#{field100007},
field100005=#{field100005},
field100010=#{field100010},
field100009=#{field100009},
</set>
where scope = 'HrmCustomFieldByInfoType'
and id = #{id}
and scopeid = #{scopeId}
</update>
<insert id="insertCusFieldData">
insert into cus_fielddata(scope, scopeid, id)
values ('HrmCustomFieldByInfoType', #{scopeId}, #{id})
</insert>
</mapper>

@ -468,8 +468,11 @@
from JCL_ORG_STAFF
where delete_type = 0
union
select job_title
from jcl_org_hrmresource
select field100002
from cus_fielddata
inner join
hrmresource on
cus_fielddata.ID = hrmresource.ID
where STATUS &lt; 4
</select>
<select id="listJobsByDepartmentId" resultMap="BaseResultMap">
@ -571,10 +574,11 @@
</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
from hrmresource a
inner join cus_fielddata b on a.id = b.id and b.scope = 'hrmcustomfieldbyinfotype' and b.scopeid = -1
inner join jcl_org_job c on b.field100002 = c.id
where a.status &lt; 4
and b.id = #{jobId}
and c.id = #{jobId}
</select>
<sql id="nullparentJob">

@ -1,25 +0,0 @@
package com.engine.organization.mapper.personnelcard;
import com.engine.organization.entity.detach.po.ManagerDetachPO;
import com.engine.organization.entity.personnelcard.po.CardAccessPO;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
/**
* @Author weaver_cl
* @Description:
* @Date 2022/10/24
* @Version V1.0
**/
public interface CardAccessMapper {
int insertIgnoreNull(CardAccessPO cardAccessPO);
int updateCardAccess(CardAccessPO cardAccessPO);
int deleteByIds(@Param("ids") Collection<Long> ids);
ManagerDetachPO selectById(@Param("id") Integer id);
}

@ -1,225 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.engine.organization.mapper.personnelcard.CardAccessMapper">
<resultMap id="BaseResultMap" type="com.engine.organization.entity.personnelcard.po.CardAccessPO">
<result column="id" property="id"/>
<result column="type_id" property="typeId"/>
<result column="type_name" property="typeName"/>
<result column="status" property="status"/>
<result column="all_people" property="allPeople"/>
<result column="superior" property="superior"/>
<result column="all_superior" property="allSuperior"/>
<result column="custom" property="custom"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t.id
, t.type_id
, t.type_name
, t.status
, t.all_people
, t.superior
, t.all_superior
, t.custom
, t.creator
, t.delete_type
, t.create_time
, t.update_time
</sql>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.personnelcard.po.CardAccessPO" keyProperty="id"
keyColumn="id" useGeneratedKeys="true">
INSERT INTO jcl_org_cardaccess
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="typeId != null ">
type_id,
</if>
<if test="typeName != null ">
type_name,
</if>
<if test="status != null ">
status,
</if>
<if test="allPeople != null ">
all_people,
</if>
<if test="superior != null ">
superior,
</if>
<if test="allSuperior != null ">
all_superior,
</if>
<if test="custom != null">
custom,
</if>
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="typeId != null ">
#{typeId},
</if>
<if test="typeName != null ">
#{typeName},
</if>
<if test="status != null ">
#{status},
</if>
<if test="allPeople != null ">
#{allPeople},
</if>
<if test="superior != null ">
#{superior},
</if>
<if test="allSuperior != null ">
#{allSuperior},
</if>
<if test="creator != null">
#{creator},
</if>
<if test="custom != null">
#{custom},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
</trim>
</insert>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.personnelcard.po.CardAccessPO" databaseId="oracle">
<selectKey keyProperty="id" resultType="long" order="AFTER">
select JCL_ORG_CARDACCESS_ID.currval from dual
</selectKey>
INSERT INTO jcl_org_cardaccess
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="typeId != null ">
type_id,
</if>
<if test="typeName != null ">
type_name,
</if>
<if test="status != null ">
status,
</if>
<if test="allPeople != null ">
all_people,
</if>
<if test="superior != null ">
superior,
</if>
<if test="allSuperior != null ">
all_superior,
</if>
<if test="custom != null">
custom,
</if>
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="typeId != null ">
#{typeId},
</if>
<if test="typeName != null ">
#{typeName},
</if>
<if test="status != null ">
#{status},
</if>
<if test="allPeople != null ">
#{allPeople},
</if>
<if test="superior != null ">
#{superior},
</if>
<if test="allSuperior != null ">
#{allSuperior},
</if>
<if test="creator != null">
#{creator},
</if>
<if test="custom != null">
#{custom},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
</trim>
</insert>
<update id="updateCardAccess" parameterType="com.engine.organization.entity.personnelcard.po.CardAccessPO">
update jcl_org_cardaccess
<set>
type_id=#{typeId},
type_name=#{typeName},
status=#{status},
all_people=#{allPeople},
all_superior=#{allSuperior},
custom=#{custom},
update_time=#{updateTime},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<update id="deleteByIds">
UPDATE jcl_org_cardaccess
SET delete_type = 1
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</update>
<select id="selectById" resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_cardaccess t
WHERE delete_type = 0
AND id = #{id}
</select>
</mapper>

@ -1,28 +0,0 @@
package com.engine.organization.mapper.personnelcard;
import com.engine.organization.entity.personnelcard.ResourceBaseTab;
import com.engine.organization.entity.personnelcard.User;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author:dxfeng
* @createTime: 2022/10/08
* @version: 1.0
*/
public interface PersonnelCardMapper {
/**
* User
*
* @param id
* @return
*/
User getUserById(@Param("id") Long id);
/**
*
* @return
*/
List<ResourceBaseTab> getResourceBaseTabList();
}

@ -1,48 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.engine.organization.mapper.personnelcard.PersonnelCardMapper">
<resultMap id="UserMap" type="com.engine.organization.entity.personnelcard.User">
<result column="id" property="id"/>
<result column="resource_image_id" property="image"/>
<result column="last_name" property="name"/>
<result column="sex" property="sex"/>
<result column="email" property="email"/>
<result column="mobile" property="phone"/>
<result column="belong_to" property="belongTo"/>
<result column="status" property="status"/>
</resultMap>
<resultMap id="BaseTabMap" type="com.engine.organization.entity.personnelcard.ResourceBaseTab">
<result column="id" property="id"/>
<result column="groupname" property="groupName"/>
<result column="grouplabel" property="groupLabel"/>
<result column="dsporder" property="dspOrder"/>
<result column="isopen" property="isOpen"/>
<result column="ismand" property="isMand"/>
<result column="isused" property="isUsed"/>
<result column="issystem" property="isSystem"/>
<result column="linkurl" property="linkUrl"/>
<result column="tabnum" property="tabNum"/>
</resultMap>
<select id="getUserById" resultMap="UserMap">
select id,
resource_image_id,
last_name,
sex,
email,
mobile,
belong_to,
status
from jcl_org_hrmresource
where id = #{id}
</select>
<select id="getResourceBaseTabList" resultMap="BaseTabMap">
select *
from HrmResourceBaseTab
where isopen = 1
order by dsporder
</select>
</mapper>

@ -1,29 +0,0 @@
package com.engine.organization.mapper.resource;
import com.engine.organization.entity.hrmresource.po.HrmResourcePO;
import com.engine.organization.entity.hrmresource.vo.HrmResourceVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Author weaver_cl
* @Description:
* @Date 2022/6/28
* @Version V1.0
**/
public interface ResourceMapper {
List<HrmResourceVO> listAll(@Param("ids")List<Long> ids);
List<HrmResourceVO> listDetachAll(@Param("ids") List<Long> ids, @Param("companyIds") List<Long> companyIds);
List<HrmResourcePO> getResourceListByJobId(@Param("jobId") Long jobId);
int updateResourceJob(@Param("originalJobId") Long originalJobId, @Param("targetJobId") Long targetJobId, @Param("parentComp") Long parentComp, @Param("parentDept") Long parentDept, @Param("ecCompany") Long ecCompany, @Param("ecDepartment") Long ecDepartment);
HrmResourcePO getResourceById(@Param("id") String id);
List<HrmResourcePO> listByNo(@Param("workCode") String workCode);
}

@ -1,147 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.engine.organization.mapper.resource.ResourceMapper">
<resultMap id="HrmResourceMap" type="com.engine.organization.entity.hrmresource.po.HrmResourcePO">
<result column="id" property="id"/>
<result column="last_name" property="lastName"/>
<result column="sex" property="sex"/>
<result column="account_type" property="accountType"/>
<result column="belong_to" property="belongTo"/>
<result column="company_id" property="companyId"/>
<result column="department_id" property="departmentId"/>
<result column="job_activity" property="jobActivity"/>
<result column="job_title" property="jobTitle"/>
<result column="job_level" property="jobLevel"/>
<result column="job_group_id" property="jobGroupId"/>
<result column="job_activity_desc" property="jobActivityDesc"/>
<result column="status" property="status"/>
<result column="resource_image_id" property="resourceImageId"/>
<result column="location_id" property="locationId"/>
<result column="mobile" property="mobile"/>
<result column="telephone" property="telephone"/>
<result column="email" property="email"/>
<result column="company_start_date" property="companyStartDate"/>
<result column="work_start_date" property="workStartDate"/>
<result column="show_order" property="showOrder"/>
<result column="ec_department" property="ecDepartment"/>
<result column="ec_company" property="ecCompany"/>
<result column="uuid" property="uuid"/>
<result column="job_grade" property="jobGrade"/>
<result column="scheme_id" property="schemeId"/>
<result column="sequence_id" property="sequenceId"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
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.
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.work_start_date,t.job_activity_desc,t.resource_image_id,t.mobile,
t.telephone,t.email,t.uuid
</sql>
<update id="updateResourceJob">
update jcl_org_hrmresource
<set>
job_title = #{targetJobId},
company_id = #{parentComp},
department_id = #{parentDept},
ec_company = #{ecCompany},
ec_department = #{ecDepartment},
</set>
where delete_type = 0 and job_title =#{originalJobId}
</update>
<select id="listAll" resultType="com.engine.organization.entity.hrmresource.vo.HrmResourceVO">
SELECT t.last_name as lastName,d.dept_name as departmentName,
c.comp_name as companyName,t.mobile,t.telephone,t1.last_name as managerName
from jcl_org_hrmresource t
left join JCL_ORG_DEPT d on t.department_id = d.id
left join jcl_org_comp c on t.company_id = c.id
left join jcl_org_hrmresource t1 on t.manager_id = t1.id
where 1 = 1
<if test="ids != null and ids.size > 0">
AND t.id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<!--<include refid="likeSql"/>-->
<!--<if test="param.departmentId != null and param.departmentId != ''">-->
<!--and t.department_id = #{param.departmentId}-->
<!--</if>-->
<!--<if test="param.companyId != null and param.companyId != ''">-->
<!--and t.company_id = #{param.companyId}-->
<!--</if>-->
<!--<if test="param.mobile != null and param.mobile != ''">-->
<!--and t.mobile = #{param.mobile}-->
<!--</if>-->
<!--<if test="param.telephone != null and param.telephone != ''">-->
<!--and t.telephone = #{param.telephone}-->
<!--</if>-->
<!--<if test="param.managerId != null and param.managerId != ''">-->
<!--and t.manager_id = #{param.managerId}-->
<!--</if>-->
<!--<if test="param.mobileCall != null and param.mobileCall != ''">-->
<!--and t.mobile_call = #{param.mobileCall}-->
<!--</if>-->
<!--<if test="param.jobTitle != null and param.jobTitle != ''">-->
<!--and t.job_title = #{param.jobTitle}-->
<!--</if>-->
order by t.id asc;
</select>
<select id="getResourceListByJobId"
resultMap="HrmResourceMap">
select
<include refid="baseColumns"/>
from jcl_org_hrmresource t where job_title = #{jobId}
</select>
<select id="getResourceById" resultType="com.engine.organization.entity.hrmresource.po.HrmResourcePO">
select
<include refid="baseColumns"/>
from jcl_org_hrmresource t where delete_type = 0 and id = #{id}
</select>
<select id="listByNo" resultMap="HrmResourceMap">
select
<include refid="baseColumns"/>
from jcl_org_hrmresource t where delete_type = 0 and work_code = #{workCode}
</select>
<select id="listDetachAll" resultType="com.engine.organization.entity.hrmresource.vo.HrmResourceVO">
SELECT t.last_name as lastName,d.dept_name as departmentName,
c.comp_name as companyName,t.mobile,t.telephone,t1.last_name as managerName
from jcl_org_hrmresource t
left join JCL_ORG_DEPT d on t.department_id = d.id
left join jcl_org_comp c on t.company_id = c.id
left join jcl_org_hrmresource t1 on t.manager_id = t1.id
where 1 = 1
<if test="ids != null and ids.size > 0">
AND t.id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
AND c.id IN
<foreach collection="companyIds" open="(" item="companyId" separator="," close=")">
#{companyId}
</foreach>
</select>
<sql id="likeSql">
<if test="param.lastName != null and param.lastName != ''">
AND t.last_name like CONCAT('%',#{param.lastName},'%')
</if>
</sql>
<sql id="likeSql" databaseId="oracle">
<if test="param.lastName != null and param.lastName != ''">
AND t.last_name like '%'||#{param.lastName}||'%'
</if>
</sql>
<sql id="likeSql" databaseId="sqlserver">
<if test="param.lastName != null and param.lastName != ''">
AND t.last_name like '%'+#{param.lastName}+'%'
</if>
</sql>
</mapper>

@ -1,6 +1,7 @@
package com.engine.organization.mapper.staff;
import com.engine.organization.entity.staff.po.StaffExportPO;
import com.engine.organization.entity.staff.po.StaffPO;
import org.apache.ibatis.annotations.Param;
@ -68,7 +69,15 @@ public interface StaffMapper {
/**
*
*
* @return
*/
StaffPO getStaffsByParamId(@Param("ftype") Integer ftype, @Param("compId") String compId, @Param("deptId") String deptId, @Param("jobId") String jobId);
/**
*
*
* @return
*/
StaffPO getStaffsByParamId(@Param("ftype") Integer ftype,@Param("compId") String compId,@Param("deptId") String deptId,@Param("jobId") String jobId);
List<StaffExportPO> getStaffExportPOs();
}

@ -350,4 +350,17 @@
and a.job_id = #{jobId}
</if>
</select>
<select id="getStaffExportPOs" resultType="com.engine.organization.entity.staff.po.StaffExportPO">
select plan_id,
comp_id,
dept_id,
job_id,
staff_num,
permanent_num,
freeze_num,
lack_status,
staff_desc
from jcl_org_staff
where delete_type = 0
</select>
</mapper>

@ -1,7 +1,7 @@
package com.engine.organization.mapper.trigger;
import com.engine.organization.entity.hrmresource.po.HrmResourcePO;
import com.engine.organization.entity.cusfielddata.po.CusFieldData;
import org.apache.ibatis.annotations.Param;
import weaver.hrm.passwordprotection.domain.HrmResource;
@ -20,11 +20,11 @@ public interface CompTriggerMapper {
String getJobTitleMarkById(@Param("id") Integer id);
CusFieldData getCusFieldDataById(@Param("id") Integer id);
Integer sumStaffNum(@Param("fdatebegin") Date fdatebegin, @Param("compId") Integer compId);
int deleteMap(@Param("ftype") Integer ftype, @Param("fobjid") Integer fobjid, @Param("fdatebegin") Date fdatebegin);
int updateMap(@Param("ftype") Integer ftype, @Param("fobjid") Integer fobjid, @Param("fdatebegin") Date fdatebegin, @Param("fdate") Date fdate);
HrmResourcePO getResourceByEcId(@Param("ecId") Integer ecId);
}

@ -31,6 +31,13 @@
from hrmjobtitles
where id = #{id}
</select>
<select id="getCusFieldDataById" resultType="com.engine.organization.entity.cusfielddata.po.CusFieldData">
select field100008, field100007
from cus_fielddata
where scope = 'HrmCustomFieldByInfoType'
and scopeid = 3
and id = #{id}
</select>
<select id="sumStaffNum" resultType="java.lang.Integer">
select sum(staff_num)
from JCL_ORG_STAFF
@ -40,11 +47,4 @@
and time_end &gt;= #{fdatebegin})
and comp_id = #{compId}
</select>
<select id="getResourceByEcId" resultMap="com.engine.organization.mapper.resource.ResourceMapper.HrmResourceMap">
select
<include refid="com.engine.organization.mapper.resource.ResourceMapper.baseColumns"/>
from jcl_org_hrmresource t
inner join hrmresource a on t.uuid = a.uuid
where t.delete_type = 0 and a.id = #{ecId}
</select>
</mapper>

@ -1,5 +1,6 @@
package com.engine.organization.mapper.trigger;
import com.engine.organization.entity.cusfielddata.po.CusFieldData;
import org.apache.ibatis.annotations.Param;
import weaver.hrm.passwordprotection.domain.HrmResource;
@ -14,6 +15,11 @@ import java.util.List;
public interface HrmResourceTriggerMapper {
HrmResource getHrmResource(@Param("id") Long id);
CusFieldData getCusFieldDataById(@Param("fObjId") Integer fObjId);
String getField100002(@Param("fObjId") Integer fObjId);
List<Long> getFidsByFleader(@Param("fLeader") String fLeader, @Param("currentDate") Date currentDate);
int updateLeaders(@Param("currentDate") Date currentDate,@Param("fLeader") String fLeader, @Param("fLeaderImg") String fLeaderImg, @Param("fLeaderName") String fLeaderName, @Param("fLeaderJobId") Integer fLeaderJobId, @Param("fLeaderJob") String fLeaderJob, @Param("fLeaderLv") String fLeaderLv, @Param("fLeaderSt") String fLeaderSt);

@ -20,6 +20,13 @@
from hrmresource
where id = #{id}
</select>
<select id="getCusFieldDataById" resultType="com.engine.organization.entity.cusfielddata.po.CusFieldData">
select field100008, field100007
from cus_fielddata
where scope = 'HrmCustomFieldByInfoType'
and scopeid = 3
and id = #{fObjId}
</select>
<select id="getFidsByFleader" resultType="java.lang.Long">
SELECT fid
@ -28,4 +35,11 @@
AND FDATEBEGIN &lt;= #{currentDate}
AND FDATEEND &gt;= #{currentDate}
</select>
<select id="getField100002" resultType="java.lang.String">
select field100002
from cus_fielddata
where scope = 'HrmCustomFieldByInfoType'
and scopeid = -1
and id = #{fObjId}
</select>
</mapper>

@ -96,8 +96,11 @@
AND FDATEEND &gt;= #{currentDate}
</select>
<select id="countOnJobByJObId" resultType="java.lang.Integer">
select count(1)
from jcl_org_hrmresource a
where a.job_title = #{jobId} and a.status &lt; 4
select count(a.id)
from hrmresource a
inner join cus_fielddata b on a.id = b.id and b.scope = 'hrmcustomfieldbyinfotype' and b.scopeid = -1
inner join jcl_org_job c on b.field100002 = c.id
where a.status &lt; 4
and c.id = #{jobId}
</select>
</mapper>

@ -1,6 +1,5 @@
package com.engine.organization.service;
import com.engine.organization.entity.hrmresource.param.HrmResourceSearchParam;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.util.List;
@ -15,8 +14,16 @@ public interface ExportCommonService {
/**
*
*
* @param ids
* @return
*/
XSSFWorkbook resourceExport(List<Long> ids);
/**
*
*
* @return
*/
XSSFWorkbook staffExport();
}

@ -1,28 +0,0 @@
package com.engine.organization.service;
import com.engine.organization.entity.personnelcard.Iframe;
import java.util.List;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2022/10/08
* @version: 1.0
*/
public interface HrmPersonnelCardService {
/**
*
*
* @param uId
* @return
*/
Map<String, Object> getPersonnelCard(Long uId);
/**
*
*
* @return
*/
List<Iframe> getIframeList();
}

@ -1,56 +0,0 @@
package com.engine.organization.service;
import com.engine.organization.entity.detach.param.ManagerDetachParam;
import java.util.Collection;
import java.util.Map;
/**
* @Author weaver_cl
* @Description:
* @Date 2022/10/21
* @Version V1.0
**/
public interface ManagerDetachService {
/**
* table
* @param params
* @return
*/
Map<String, Object> listPage(Map<String, Object> params);
/**
*
* @param id
* @return
*/
Map<String, Object> getForm(Integer id);
/**
*
* @param ids
* @return
*/
int deleteByIds(Collection<Long> ids);
/**
*
* @param param
* @return
*/
int save(ManagerDetachParam param);
/**
*
* @param param
* @return
*/
int updateDetach(ManagerDetachParam param);
/**
*
* @param isDetach
*/
String doDetach(String isDetach);
}

@ -34,7 +34,6 @@ import com.engine.organization.thread.OrganizationSyncEc;
import com.engine.organization.util.*;
import com.engine.organization.util.coderule.CodeRuleUtil;
import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.detach.DetachUtil;
import com.engine.organization.util.page.Column;
import com.engine.organization.util.page.PageInfo;
import com.engine.organization.util.page.PageUtil;
@ -114,12 +113,10 @@ public class CompServiceImpl extends Service implements CompService {
PageInfo<CompListDTO> pageInfos;
String orderSql = PageInfoSortUtil.getSortSql(params.getSortParams());
List<CompPO> allList = getCompMapper().list(orderSql);
new DetachUtil(user.getUID()).filterCompanyList(allList);
// 通过子级遍历父级元素
if (filter) {
// 根据条件获取元素
List<CompPO> filterCompPOs = getCompMapper().listByFilter(compPO, orderSql);
new DetachUtil(user.getUID()).filterCompanyList(filterCompPOs);
// 添加父级元素
List<CompListDTO> compListDTOS = CompBO.buildCompDTOList(allList, filterCompPOs);

@ -48,7 +48,6 @@ import com.engine.organization.thread.OrganizationSyncEc;
import com.engine.organization.util.*;
import com.engine.organization.util.coderule.CodeRuleUtil;
import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.detach.DetachUtil;
import com.engine.organization.util.page.Column;
import com.engine.organization.util.page.PageInfo;
import com.engine.organization.util.page.PageUtil;
@ -178,12 +177,10 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
PageInfo<DepartmentListDTO> pageInfos;
String orderSql = PageInfoSortUtil.getSortSql(param.getSortParams());
List<DepartmentPO> allList = getDepartmentMapper().list(orderSql);
new DetachUtil(user.getUID()).filterDepartmentList(allList);
// 通过子级遍历父级元素
if (filter) {
// 根据条件获取元素
List<DepartmentPO> filterDeptPOs = getDepartmentMapper().listByFilter(departmentPO, orderSql);
new DetachUtil(user.getUID()).filterDepartmentList(filterDeptPOs);
// 添加父级元素
List<DepartmentListDTO> compListDTOS = DepartmentBO.buildDeptDTOList(allList, filterDeptPOs);
List<DepartmentListDTO> subList = PageUtil.subList(param.getCurrent(), param.getPageSize(), compListDTOS);
@ -660,7 +657,6 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
// 更新当前部门下的人员
List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIdsByDept(mergeParam.getId().toString());
rs.executeUpdate("update hrmresource set SUBCOMPANYID1 =?,DEPARTMENTID =? where DEPARTMENTID =?", targetDepartment.getEcCompany(), 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());
// 更新人员组织架构图
for (Long hrmResourceId : hrmResourceIds) {
new HrmResourceTriggerRunnable(hrmResourceId).run();
@ -763,7 +759,6 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIdsByDept(deptById.getId().toString());
String ecDepartmentId = EcHrmRelationUtil.getEcDepartmentId(deptById.getId().toString());
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 =?", deptById.getParentComp(), ecCompanyId, deptById.getId());
// 更新人员组织架构图
for (Long hrmResourceId : hrmResourceIds) {
new HrmResourceTriggerRunnable(hrmResourceId).run();
@ -796,7 +791,6 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIdsByDept(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 jcl_org_hrmresource set company_id =? ,ec_company = ? where department_id =?", parentComp, ecCompanyId, departmentPO.getId());
// 更新人员组织架构图
for (Long hrmResourceId : hrmResourceIds) {
new HrmResourceTriggerRunnable(hrmResourceId).run();
@ -839,9 +833,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
Long parentCompId = StringUtil.isEmpty(id) ? null : Long.parseLong(id);
CompPO compBuild = CompPO.builder().compName(keyword).parentCompany(parentCompId).forbiddenTag(0).build();
List<CompPO> allCompanys = getCompMapper().list("show_order");
new DetachUtil(user.getUID()).filterCompanyList(allCompanys);
List<CompPO> filterComps = getCompMapper().listByFilter(compBuild, "show_order");
new DetachUtil(user.getUID()).filterCompanyList(filterComps);
Map<Long, CompPO> allMaps = allCompanys.stream().collect(Collectors.toMap(CompPO::getId, item -> item, (k1, k2) -> k1));

@ -2,20 +2,19 @@ package com.engine.organization.service.impl;
import com.engine.core.impl.Service;
import com.engine.organization.entity.hrmresource.vo.HrmResourceVO;
import com.engine.organization.mapper.resource.ResourceMapper;
import com.engine.organization.entity.staff.po.StaffExportPO;
import com.engine.organization.mapper.hrmresource.HrmResourceMapper;
import com.engine.organization.mapper.staff.StaffMapper;
import com.engine.organization.service.ExportCommonService;
import com.engine.organization.util.HrmI18nUtil;
import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.detach.DetachUtil;
import com.engine.organization.util.excel.ExcelUtil;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Author weaver_cl
@ -28,18 +27,8 @@ public class ExportCommonServiceImpl extends Service implements ExportCommonServ
@Override
public XSSFWorkbook resourceExport(List<Long> ids) {
List<HrmResourceVO> hrmResourceVOS ;
DetachUtil detachUtil = new DetachUtil(user.getUID());
if (detachUtil.isDETACH()) {
if (StringUtils.isBlank(detachUtil.getJclRoleLevels())) {
hrmResourceVOS = new ArrayList<>();
} else {
List<Long> jclRoleLevelList = Arrays.stream(detachUtil.getJclRoleLevels().split(",")).map(Long::parseLong).collect(Collectors.toList());
hrmResourceVOS = MapperProxyFactory.getProxy(ResourceMapper.class).listDetachAll(ids, jclRoleLevelList);
}
} else {
hrmResourceVOS = MapperProxyFactory.getProxy(ResourceMapper.class).listAll(ids);
}
List<HrmResourceVO> hrmResourceVOS = MapperProxyFactory.getProxy(HrmResourceMapper.class).listAll(ids);
if (hrmResourceVOS == null) {
hrmResourceVOS = new ArrayList<>();
}
@ -49,12 +38,12 @@ public class ExportCommonServiceImpl extends Service implements ExportCommonServ
List<List<Object>> excelSheetData = new ArrayList<>();
String[] header = {
HrmI18nUtil.getI18nLabel( 93270, "姓名"),
HrmI18nUtil.getI18nLabel( 93272, "部门"),
HrmI18nUtil.getI18nLabel( 93274, "分部"),
HrmI18nUtil.getI18nLabel( 93275, "移动电话"),
HrmI18nUtil.getI18nLabel( 93278, "办公室电话"),
HrmI18nUtil.getI18nLabel( 93279, "直接上级")};
HrmI18nUtil.getI18nLabel(93270, "姓名"),
HrmI18nUtil.getI18nLabel(93272, "部门"),
HrmI18nUtil.getI18nLabel(93274, "分部"),
HrmI18nUtil.getI18nLabel(93275, "移动电话"),
HrmI18nUtil.getI18nLabel(93278, "办公室电话"),
HrmI18nUtil.getI18nLabel(93279, "直接上级")};
excelSheetData.add(Arrays.asList(header));
//数据
@ -73,5 +62,49 @@ public class ExportCommonServiceImpl extends Service implements ExportCommonServ
return ExcelUtil.genWorkbookV2(excelSheetData, sheetName);
}
@Override
public XSSFWorkbook staffExport() {
List<StaffExportPO> staffExportPOs = MapperProxyFactory.getProxy(StaffMapper.class).getStaffExportPOs();
if (staffExportPOs == null) {
staffExportPOs = new ArrayList<>();
}
// 1.工作簿名称
String sheetName = HrmI18nUtil.getI18nLabel(85368, "编制信息");
// 2.表头(后面动态获取)
List<List<Object>> excelSheetData = new ArrayList<>();
String[] header = {
HrmI18nUtil.getI18nLabel(93270, "方案"),
HrmI18nUtil.getI18nLabel(93272, "分部"),
HrmI18nUtil.getI18nLabel(93274, "部门"),
HrmI18nUtil.getI18nLabel(93275, "岗位"),
HrmI18nUtil.getI18nLabel(93278, "编制数"),
HrmI18nUtil.getI18nLabel(93278, "在编"),
HrmI18nUtil.getI18nLabel(93278, "冻结数"),
HrmI18nUtil.getI18nLabel(93278, "缺编状态"),
HrmI18nUtil.getI18nLabel(93279, "编制描述")
};
excelSheetData.add(Arrays.asList(header));
//数据
List<List<Object>> rows = new LinkedList<>();
for (StaffExportPO vo : staffExportPOs) {
List<Object> row = new LinkedList<>();
row.add(vo.getPlanId());
row.add(vo.getCompId());
row.add(vo.getDeptId());
row.add(vo.getJobId());
row.add(vo.getStaffNum());
row.add(vo.getPermanentNum());
row.add(vo.getFreezeNum());
row.add(vo.getLackStatus());
row.add(vo.getStaffDesc());
rows.add(row);
}
excelSheetData.addAll(rows);
return ExcelUtil.genWorkbookV2(excelSheetData, sheetName);
}
}

@ -1,210 +0,0 @@
package com.engine.organization.service.impl;
import com.engine.core.impl.Service;
import com.engine.organization.entity.extend.ExtendInfoOperateType;
import com.engine.organization.entity.extend.bo.ExtendGroupBO;
import com.engine.organization.entity.extend.param.ExtendInfoParams;
import com.engine.organization.entity.extend.po.ExtendGroupPO;
import com.engine.organization.entity.extend.po.ExtendInfoPO;
import com.engine.organization.entity.extend.po.ExtendTitlePO;
import com.engine.organization.entity.personnelcard.*;
import com.engine.organization.mapper.extend.ExtMapper;
import com.engine.organization.mapper.extend.ExtendGroupMapper;
import com.engine.organization.mapper.extend.ExtendInfoMapper;
import com.engine.organization.mapper.extend.ExtendTitleMapper;
import com.engine.organization.mapper.hrmresource.HrmResourceMapper;
import com.engine.organization.mapper.personnelcard.PersonnelCardMapper;
import com.engine.organization.service.HrmPersonnelCardService;
import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.db.DBType;
import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.field.FieldDefinedValueUtil;
import com.engine.portal.biz.constants.ModuleConstants;
import com.engine.portal.biz.nonstandardfunction.SysModuleInfoBiz;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.blog.BlogShareManager;
import weaver.cowork.CoworkShareManager;
import weaver.crm.CrmShareBase;
import weaver.docs.search.DocSearchComInfo;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.workflow.search.WorkflowRequestUtil;
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/10/08
* @version: 1.0
*/
public class HrmPersonnelCardServiceImpl extends Service implements HrmPersonnelCardService {
private static final String IS_SHOW = "1";
private PersonnelCardMapper getPersonnelCardMapper() {
return MapperProxyFactory.getProxy(PersonnelCardMapper.class);
}
private ExtendGroupMapper getExtendGroupMapper() {
return MapperProxyFactory.getProxy(ExtendGroupMapper.class);
}
private ExtendTitleMapper getExtendTitleMapper() {
return MapperProxyFactory.getProxy(ExtendTitleMapper.class);
}
private ExtendInfoMapper getExtendInfoMapper() {
return MapperProxyFactory.getProxy(ExtendInfoMapper.class);
}
private ExtMapper getExtMapper() {
return MapperProxyFactory.getProxy(ExtMapper.class);
}
private HrmResourceMapper getHrmResourceMapper() {
return MapperProxyFactory.getProxy(HrmResourceMapper.class);
}
@Override
public Map<String, Object> getPersonnelCard(Long uId) {
Map<String, Object> resultMap = new HashMap<>();
User userInfo;
//TODO 人员表之前关联关系处理UID
if (null == uId) {
uId = getHrmResourceMapper().getJclResourceId(Util.null2String(user.getUID()));
}
String ecResourceId = getHrmResourceMapper().getEcResourceId(uId.toString());
userInfo = getPersonnelCardMapper().getUserById(uId);
userInfo.setEcId(ecResourceId);
OrganizationAssert.notNull(uId, "未找到对应数据");
// 人员基本信息
// 统计报表
Statistical statistical = getStatistical(ecResourceId);
List<ExtendGroupPO> extendGroupList = getExtendGroupMapper().listByType(4, IS_SHOW);
// 获取前三个模块的信息
List<FormItem> formItemList = new ArrayList<>();
for (ExtendGroupPO groupPO : extendGroupList) {
FormItem formItem = getFormItem(groupPO, uId);
if (CollectionUtils.isEmpty(formItem.getItems())) {
continue;
}
formItemList.add(formItem);
}
// 所有锚点
List<Anchor> anchorList = new ArrayList<>();
// 添加字段分组信息
for (FormItem formItem : formItemList) {
anchorList.add(Anchor.builder().id(formItem.getId()).title(formItem.getTitle()).build());
}
// 添加拓展页面信息
List<ResourceBaseTab> resourceBaseTabList = getPersonnelCardMapper().getResourceBaseTabList();
for (ResourceBaseTab resourceBaseTab : resourceBaseTabList) {
anchorList.add(Anchor.builder().id("tab" + resourceBaseTab.getId()).title(resourceBaseTab.getGroupName()).build());
}
resultMap.put("user", userInfo);
resultMap.put("statistical", statistical);
resultMap.put("formItems", formItemList);
resultMap.put("anchorList", anchorList);
resultMap.put("iframeList", getIframeList());
return resultMap;
}
@Override
public List<Iframe> getIframeList() {
List<Iframe> iframeList = new ArrayList<>();
List<ResourceBaseTab> resourceBaseTabList = getPersonnelCardMapper().getResourceBaseTabList();
for (ResourceBaseTab resourceBaseTab : resourceBaseTabList) {
iframeList.add(Iframe.builder().id("tab" + resourceBaseTab.getId()).title(resourceBaseTab.getGroupName()).url(resourceBaseTab.getLinkUrl()).build());
}
return iframeList;
}
/**
*
*
* @param ecResourceId
* @return
*/
private Statistical getStatistical(String ecResourceId) {
try {
// 获取Ec用户ID
Statistical statistical = new Statistical();
if (SysModuleInfoBiz.checkModuleStatus(ModuleConstants.Workflow)) {
statistical.setWorkflowCount(new WorkflowRequestUtil().getRequestCount(user, ecResourceId));
} else {
statistical.setWorkflowCount(0);
}
if (SysModuleInfoBiz.checkModuleStatus(ModuleConstants.Doc)) {
Object[] docCount4Hrm = new DocSearchComInfo().getDocCount4Hrm(ecResourceId, user);
statistical.setDocCount(null == docCount4Hrm[1] ? 0 : Integer.parseInt(Util.null2String(docCount4Hrm[1])));
} else {
statistical.setDocCount(0);
}
if (SysModuleInfoBiz.checkModuleStatus(ModuleConstants.Crm)) {
String[] crmCount4Hrm = new CrmShareBase().getCrmCount4Hrm(ecResourceId, ecResourceId);
statistical.setCusCount(null == crmCount4Hrm[1] ? 0 : Integer.parseInt(Util.null2String(crmCount4Hrm[1])));
} else {
statistical.setCusCount(0);
}
if (SysModuleInfoBiz.checkModuleStatus(ModuleConstants.Cowork)) {
String[] coworkCount4Hrm = new CoworkShareManager().getCoworkCount4Hrm(ecResourceId, ecResourceId);
statistical.setCollaborationCount(null == coworkCount4Hrm[1] ? 0 : Integer.parseInt(Util.null2String(coworkCount4Hrm[1])));
} else {
statistical.setCollaborationCount(0);
}
if (SysModuleInfoBiz.checkModuleStatus(ModuleConstants.Blog)) {
String[] blogCount4Hrm = new BlogShareManager().getBlogCount4Hrm(ecResourceId);
statistical.setWeiboCount(null == blogCount4Hrm[1] ? 0 : Integer.parseInt(Util.null2String(blogCount4Hrm[1])));
} else {
statistical.setWeiboCount(0);
}
return statistical;
} catch (Exception e) {
new BaseBean().writeLog(e);
throw new RuntimeException(e);
}
}
private FormItem getFormItem(ExtendGroupPO extendGroup, Long uId) {
FormItem formItem = new FormItem();
formItem.setId("group" + extendGroup.getId());
formItem.setTitle(extendGroup.getGroupName());
List<ExtendTitlePO> extendTitleList = getExtendTitleMapper().getTitlesByGroupID(extendGroup.getId(), IS_SHOW);
List<Item> itemList = new ArrayList<>();
for (ExtendTitlePO extendTitlePO : extendTitleList) {
List<ExtendInfoPO> extendInfoList = getExtendInfoMapper().listFields(extendGroup.getExtendType().toString(), extendTitlePO.getId().toString(), ExtendGroupBO.getTableNameByGroupPO(extendGroup), ExtendInfoOperateType.LIST.getValue(), IS_SHOW);
String fields = extendInfoList.stream().map(ExtendInfoPO::getFieldName).collect(Collectors.joining(","));
if (StringUtils.isBlank(fields)) {
continue;
}
ExtendInfoParams infoParams = ExtendInfoParams.builder().tableName(ExtendGroupBO.getTableNameByGroupPO(extendGroup)).fields(fields).params(null).id(uId).build();
Map<String, Object> fieldValueMap = getExtMapper().listExt(infoParams);
for (ExtendInfoPO extendInfoPO : extendInfoList) {
String fieldShowName = "";
if (null != fieldValueMap) {
Object fieldValue;
if (DBType.isOracle()) {
fieldValue = fieldValueMap.get(extendInfoPO.getFieldName().toUpperCase());
} else {
fieldValue = fieldValueMap.get(extendInfoPO.getFieldName());
}
fieldShowName = FieldDefinedValueUtil.getFieldValue(user, extendInfoPO, Util.null2String(fieldValue));
}
itemList.add(Item.builder().fieldId(extendInfoPO.getFieldNameDesc()).fieldValue(fieldShowName).build());
}
}
formItem.setItems(itemList);
return formItem;
}
}

@ -1,769 +0,0 @@
package com.engine.organization.service.impl;
import com.api.browser.bean.BrowserBean;
import com.api.browser.bean.SearchConditionGroup;
import com.api.browser.bean.SearchConditionItem;
import com.cloudstore.eccom.result.WeaResultMsg;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.hrm.entity.RuleCodeType;
import com.engine.hrm.util.face.HrmFaceCheckManager;
import com.engine.organization.component.OrganizationWeaTable;
import com.engine.organization.entity.DeleteParam;
import com.engine.organization.entity.codesetting.po.CodeRulePO;
import com.engine.organization.entity.commom.RecordInfo;
import com.engine.organization.entity.company.bo.CompBO;
import com.engine.organization.entity.company.po.CompPO;
import com.engine.organization.entity.department.bo.DepartmentBO;
import com.engine.organization.entity.department.po.DepartmentPO;
import com.engine.organization.entity.extend.po.ExtendTitlePO;
import com.engine.organization.entity.hrmresource.bo.HrmRelationBO;
import com.engine.organization.entity.hrmresource.param.HrmRelationSaveParam;
import com.engine.organization.entity.hrmresource.param.HrmResourceSearchParam;
import com.engine.organization.entity.hrmresource.po.HrmRelationPO;
import com.engine.organization.entity.hrmresource.po.HrmResourcePO;
import com.engine.organization.entity.hrmresource.vo.HrmResourceVO;
import com.engine.organization.entity.job.bo.JobBO;
import com.engine.organization.entity.job.po.JobPO;
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.mapper.codesetting.CodeRuleMapper;
import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.mapper.extend.ExtendTitleMapper;
import com.engine.organization.mapper.hrmresource.HrmRelationMapper;
import com.engine.organization.mapper.hrmresource.HrmResourceMapper;
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;
import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.OrganizationFormItemUtil;
import com.engine.organization.util.coderule.CodeRuleUtil;
import com.engine.organization.util.db.DBType;
import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.detach.DetachUtil;
import com.engine.organization.util.page.PageUtil;
import com.engine.organization.util.tree.SearchTreeUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.StringUtil;
import weaver.general.Util;
import weaver.hrm.User;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author:dxfeng
* @createTime: 2022/06/20
* @version: 1.0
*/
public class HrmResourceServiceImpl extends Service implements HrmResourceService {
/**
*
* <p>
* 0
* 1
* 2
* 3
*/
private static final String TYPE_COMP = "1";
private static final String TYPE_DEPT = "2";
private static final String TYPE_JOB = "3";
private static final Long GROUP_ID = 4L;
/**
*
* 1
* 2
* 3
* 4
*/
private static final String EXTEND_TYPE = "4";
/**
*
*/
private static final String JCL_ORG_HRM = "JCL_ORG_HRMRESOURCE";
/**
*
*/
private static final String JCL_ORG_HRMEXT = "JCL_ORG_HRMRESOURCEEXT";
/**
*
*/
private static final String JCL_ORG_HRMEXT_DT1 = "JCL_ORG_HRMRESOURCEEXT_DT1";
private static final String HRM_RESOURCE = "hrmresource";
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);
}
private DepartmentMapper getDepartmentMapper() {
return MapperProxyFactory.getProxy(DepartmentMapper.class);
}
private CompMapper getCompMapper() {
return MapperProxyFactory.getProxy(CompMapper.class);
}
private JobMapper getJobMapper() {
return MapperProxyFactory.getProxy(JobMapper.class);
}
private HrmResourceMapper getHrmResourceMapper() {
return MapperProxyFactory.getProxy(HrmResourceMapper.class);
}
private static ResourceMapper getResourceMapper() {
return MapperProxyFactory.getProxy(ResourceMapper.class);
}
private ExtendTitleMapper getExtendTitleMapper() {
return MapperProxyFactory.getProxy(ExtendTitleMapper.class);
}
private SystemDataMapper getSystemDataMapper() {
return MapperProxyFactory.getProxy(SystemDataMapper.class);
}
private ExtService getExtService(User user) {
return ServiceUtil.getService(ExtServiceImpl.class, user);
}
@Override
public Map<String, Object> getSearchTree(SearchTreeParams params) {
String keyword = params.getKeyword();
String id = params.getId();
String type = Util.null2String(params.getType());
List<SearchTree> treeList = getFilterCompany(id, type, keyword);
return SearchTreeUtil.getSearchTree(type, treeList);
}
@Override
public Map<String, Object> listPage(HrmResourceSearchParam params) {
OrganizationWeaTable<HrmResourceVO> table = new OrganizationWeaTable<>(user, HrmResourceVO.class);
String sqlWhere = buildSqlWhere(params);
table.setSqlwhere(sqlWhere);
WeaResultMsg result = new WeaResultMsg(false);
result.putAll(table.makeDataResult());
result.success();
return new HashMap<>(result.getResultMap());
}
@Override
public Map<String, Object> getSaveForm() {
Map<String, Object> apiDatas = new HashMap<>();
List<SearchConditionGroup> addGroups = new ArrayList<>();
List<ExtendTitlePO> extendTitles = getExtendTitleMapper().getTitlesByGroupID(GROUP_ID, "1");
if (CollectionUtils.isNotEmpty(extendTitles)) {
for (ExtendTitlePO extendTitle : extendTitles) {
List<SearchConditionItem> items = getExtService(user).getExtSaveForm(user, EXTEND_TYPE + "", JCL_ORG_HRM, 2, extendTitle.getId().toString(), null, null, null);
if (CollectionUtils.isNotEmpty(items)) {
addGroups.add(new SearchConditionGroup(extendTitle.getTitle(), true, items));
}
}
}
apiDatas.put("condition", addGroups);
return apiDatas;
}
@Override
public Long saveBaseForm(Map<String, Object> params) {
HasRightUtil.hasRight(user, RIGHT_NAME, false);
String workCode = (String) params.get("work_code");
// 判断是否开启自动编号
workCode = repeatDetermine(workCode);
params.put("work_code", workCode);
// 完善新增参数
completeParams(params);
// 新增EC人员,新增成功后,新增到聚才林人员表
Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.RESOURCE, OperateTypeEnum.ADD, params).sync();
String ecResourceId = Util.null2String(syncMap.get("id"));
OrganizationAssert.isTrue(StringUtils.isNotBlank(ecResourceId), Util.null2String(syncMap.get("message")));
// 获取人员UUID
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();
return resourceId;
}
@Override
public Map<String, Object> getBaseForm(Map<String, Object> params) {
OrganizationAssert.notNull(params.get("viewAttr"), "请标识操作类型");
// 2编辑 1查看
int viewAttr = Integer.parseInt((String) params.get("viewAttr"));
long id = Long.parseLong((String) params.get("id"));
String groupId = (String) params.get("viewCondition");
HashMap<String, Object> buttonsMap = new HashMap<>();
buttonsMap.put("hasEdit", true);
buttonsMap.put("hasSave", true);
List<SearchConditionGroup> addGroups = new ArrayList<>();
if ("0".equals(groupId)) {
groupId = GROUP_ID.toString();
}
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_HRM : JCL_ORG_HRMEXT, viewAttr, id, extendTitle.getId() + "", "");
if (CollectionUtils.isNotEmpty(items)) {
addGroups.add(new SearchConditionGroup(extendTitle.getTitle(), true, items));
}
}
}
HashMap<String, Object> resultMap = new HashMap<>();
resultMap.put("buttons", buttonsMap);
resultMap.put("conditions", addGroups);
resultMap.put("id", id);
// 拓展页面分组
resultMap.put("tabInfo", getExtService(user).getTabInfo(EXTEND_TYPE, JCL_ORG_HRMEXT));
// 处理明细表
resultMap.put("tables", getExtService(user).getExtendTables(user, EXTEND_TYPE, Long.parseLong(groupId), JCL_ORG_HRMEXT_DT1, id, viewAttr, false));
Map<String, Object> apiDatas = new HashMap<>();
apiDatas.put("result", resultMap);
return apiDatas;
}
@Override
public int updateForm(Map<String, Object> params) {
Long id = Long.parseLong((String) params.get("id"));
String groupId = (String) params.get("viewCondition");
if ("0".equals(groupId)) {
groupId = GROUP_ID.toString();
}
// 判断编号是否重复
String workCode = Util.null2String(params.get("work_code"));
HrmResourcePO resourceById = getResourceMapper().getResourceById(id.toString());
if (!workCode.equals(resourceById.getWorkCode())) {
workCode = repeatDetermine(workCode);
params.put("work_code", workCode);
}
// 完善更新参数
completeParams(params);
// 更新EC人员,更新成功后,更新聚才林人员表
Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.RESOURCE, OperateTypeEnum.UPDATE, params).sync();
String ecResourceId = Util.null2String(syncMap.get("id"));
OrganizationAssert.isTrue(StringUtils.isNotBlank(ecResourceId), Util.null2String(syncMap.get("message")));
int updateCount = 0;
// 更新主表数据
updateCount += getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_HRM, params, "", id);
// 更新主表拓展表
getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_HRMEXT, params, groupId, id);
//更新明细表
getExtService(user).updateExtDT(user, EXTEND_TYPE, JCL_ORG_HRMEXT_DT1, params, id);
new HrmResourceTriggerRunnable(id).run();
return updateCount;
}
@Override
public Map<String, Object> getSearchCondition(Map<String, Object> params) {
Map<String, Object> apiDatas = new HashMap<>();
List<SearchConditionGroup> addGroups = new ArrayList<>();
List<SearchConditionItem> conditionItems = new ArrayList<>();
SearchConditionItem lastNameItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "姓名", "lastName");
SearchConditionItem jobTitleItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "岗位", "666", "jobTitle", "");
SearchConditionItem companyIdItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "分部", "164", "ecCompany", "");
SearchConditionItem departmentIdItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "部门", "4", "ecDepartment", "");
SearchConditionItem telephoneItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "办公电话", "telephone");
SearchConditionItem mobileItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "移动电话", "mobile");
conditionItems.add(lastNameItem);
conditionItems.add(jobTitleItem);
conditionItems.add(companyIdItem);
conditionItems.add(departmentIdItem);
conditionItems.add(telephoneItem);
conditionItems.add(mobileItem);
addGroups.add(new SearchConditionGroup("高级搜索条件", true, conditionItems));
apiDatas.put("conditions", addGroups);
return apiDatas;
}
@Override
public Map<String, Object> getHasRight() {
Map<String, Object> btnDatas = new HashMap<>();
ArrayList<MenuBtn> topMenuList = new ArrayList<>();
ArrayList<MenuBtn> rightMenuList = new ArrayList<>();
topMenuList.add(MenuBtn.builder().isBatch("1").isTop("1").menuFun("new").menuIcon("icon-coms-New-Flow").menuName("新建人员").type("BTN_Addnew").build());
btnDatas.put("topMenu", topMenuList);
rightMenuList.add(MenuBtn.builder().isBatch("1").isTop("1").menuFun("new").menuIcon("icon-coms-New-Flow").menuName("新建人员").type("BTN_Addnew").build());
rightMenuList.add(MenuBtn.builder().isBatch("0").isTop("0").menuFun("custom").menuIcon("icon-coms-task-list").menuName("显示列定制").type("BTN_COLUMN").build());
rightMenuList.add(MenuBtn.rightMenu_btnLog());
btnDatas.put("rightMenu", rightMenuList);
btnDatas.put("hasRight", HasRightUtil.hasRight(user, RIGHT_NAME, true));
return btnDatas;
}
@Override
public Map<String, Object> getTabForm(Map<String, Object> params) {
String viewAttrStr = (String) params.get("viewAttr");
OrganizationAssert.notBlank(viewAttrStr, "未指定操作类型,请确认");
String id = Util.null2String(params.get("id"));
OrganizationAssert.notBlank(id, "数据有误,请确认");
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);
return apiDatas;
}
@Override
public long saveTabForm(HrmRelationSaveParam params) {
HrmRelationPO hrmRelationPO = HrmRelationBO.convertSaveParamToPO(params);
hrmRelationPO.setCreator((long) user.getUID());
hrmRelationPO.setCreateTime(new Date());
hrmRelationPO.setDeleteType(0);
getHrmRelationMapper().insertIgnoreNull(hrmRelationPO);
return hrmRelationPO.getId();
}
@Override
public long updateTabForm(HrmRelationSaveParam params) {
HrmRelationPO hrmRelationPO = HrmRelationBO.convertSaveParamToPO(params);
// 判断新增OR更新
HrmRelationPO relationPO = getHrmRelationMapper().getRelationById(params.getId());
if (null == relationPO) {
hrmRelationPO.setCreator((long) user.getUID());
hrmRelationPO.setCreateTime(new Date());
hrmRelationPO.setDeleteType(0);
getHrmRelationMapper().insertIgnoreNull(hrmRelationPO);
} else {
hrmRelationPO.setUpdateTime(new Date());
getHrmRelationMapper().updateHrmRelation(hrmRelationPO);
}
RecordSet rs = new RecordSet();
rs.execute("update HrmResource set subcompanyid1 = " + params.getCompanyId() + " ,departmentid = " + params.getDepartmentId() + " ,jobtitle = " + params.getJobId() + " where id = " + params.getId());
HrmFaceCheckManager.sync(params.getId().toString(), HrmFaceCheckManager.getOptUpdate(), "hrm_e9_HrmResourceBaseService_editResourceBase", HrmFaceCheckManager.getOaResource());
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);
}
}
/**
*
*
* @param params
* @return
*/
private String buildSqlWhere(HrmResourceSearchParam params) {
DBType dbType = DBType.get(new RecordSet().getDBType());
String sqlWhere = " where 1=1 ";
String lastName = params.getLastName();
if (StringUtils.isNotBlank(lastName)) {
sqlWhere += " AND t.last_name " + dbType.like(lastName);
}
Long companyId = params.getCompanyId();
if (null != companyId) {
sqlWhere += " AND t.company_id = '" + companyId + "'";
}
Long departmentId = params.getDepartmentId();
if (null != departmentId) {
sqlWhere += " AND t.department_id = '" + departmentId + "'";
}
Long ecCompany = params.getEcCompany();
if (null != ecCompany) {
sqlWhere += " AND t.ec_company = '" + ecCompany + "'";
}
Long ecDepartment = params.getEcDepartment();
if (null != ecDepartment) {
sqlWhere += " AND t.ec_department = '" + ecDepartment + "'";
}
String telephone = params.getTelephone();
if (StringUtils.isNotBlank(telephone)) {
sqlWhere += " AND t.telephone " + dbType.like(telephone);
}
String mobile = params.getMobile();
if (StringUtils.isNotBlank(mobile)) {
sqlWhere += " AND t.mobile " + dbType.like(mobile);
}
Long jobTitle = params.getJobTitle();
if (null != jobTitle) {
sqlWhere += " AND t.job_title = '" + jobTitle + "'";
}
// 分权查询
DetachUtil detachUtil = new DetachUtil(user.getUID());
String parentCompanyIds = detachUtil.getJclRoleLevels();
if (detachUtil.isDETACH()) {
sqlWhere += " And t.company_id in(" + parentCompanyIds + ")";
}
return sqlWhere;
}
public List<SearchTree> getFilterCompany(String id, String type, String keyword) {
List<SearchTree> searchTree = new ArrayList<>();
// 通过分部、公司 组装数据
if (StringUtil.isEmpty(id) || TYPE_COMP.equals(type)) {
Long parentCompId = StringUtil.isEmpty(id) ? null : Long.parseLong(id);
DepartmentPO departmentBuild = DepartmentPO.builder().deptName(keyword).parentComp(parentCompId).build();
CompPO compBuild = CompPO.builder().compName(keyword).parentCompany(parentCompId).build();
// 所属分部下的岗位
JobPO jobBuild = JobPO.builder().jobName(keyword).parentComp(parentCompId).build();
searchTree = buildTreeByCompAndDept(departmentBuild, compBuild, jobBuild);
} else if (TYPE_DEPT.equals(type)) {
Long parentDeptId = Long.parseLong(id);
DepartmentPO departmentBuild = DepartmentPO.builder().deptName(keyword).parentDept(parentDeptId).build();
// 所属分部下的岗位
JobPO jobBuild = JobPO.builder().jobName(keyword).parentDept(parentDeptId).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());
Set<JobPO> builderJobs = new HashSet<>();
for (JobPO departmentPO : filterDeparts) {
buildParentJobs(departmentPO, builderJobs);
}
searchTree = SearchTreeUtil.builderTreeMode(JobBO.buildSetToSearchTree(builderJobs));
}
return searchTree;
}
/**
*
*
* @param departmentBuild
* @param compBuild
* @param jobBuild
* @return
*/
private List<SearchTree> buildTreeByCompAndDept(DepartmentPO departmentBuild, CompPO compBuild, JobPO jobBuild) {
List<JobPO> jobPOS = getJobMapper().listPOsByFilter(jobBuild);
new DetachUtil(user.getUID()).filterJobList(jobPOS);
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild, "show_order");
new DetachUtil(user.getUID()).filterDepartmentList(filterDeparts);
// 添加父级岗位
Set<JobPO> builderJobs = new HashSet<>();
for (JobPO jobPO : jobPOS) {
buildParentJobs(jobPO, builderJobs);
}
// 添加岗位的上级部门或分部
List<SearchTree> jobTrees = SearchTreeUtil.builderTreeMode(JobBO.buildSetToSearchTree(builderJobs));
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();
int ceilCount = (int) Math.ceil((double) ids.size() / 1000);
List<DepartmentPO> departmentsByIds = new ArrayList<>();
for (int i = 1; i < ceilCount + 1; i++) {
List<Long> longs = PageUtil.subList(i, 1000, ids);
List<DepartmentPO> departmentsById = getDepartmentMapper().getDeptsByIds(longs);
if (CollectionUtils.isNotEmpty(departmentsById)) {
departmentsByIds.addAll(departmentsById);
}
}
if (CollectionUtils.isNotEmpty(departmentsByIds)) {
filterDeparts.addAll(departmentsByIds);
}
}
// 查询分部信息
List<CompPO> filterComps = getCompMapper().listByFilter(compBuild, "show_order");
new DetachUtil(user.getUID()).filterCompanyList(filterComps);
Set<DepartmentPO> builderDeparts = new HashSet<>();
for (DepartmentPO departmentPO : filterDeparts) {
buildParentDepts(departmentPO, builderDeparts);
}
List<SearchTree> departmentList = DepartmentBO.buildSetToSearchTree(builderDeparts, false);
List<SearchTree> deptTrees = SearchTreeUtil.builderTreeMode(departmentList);
List<SearchTree> searchTrees = SearchTreeUtil.builderTreeMode(departmentList, jobTrees);
// 添加部门的上级分部
String parentCompS = deptTrees.stream().map(SearchTree::getParentComp).collect(Collectors.joining(","));
if (!StringUtil.isEmpty(parentCompS)) {
List<CompPO> compsByIds = getCompMapper().getCompsByIds(DeleteParam.builder().ids(parentCompS).build().getIds());
if (CollectionUtils.isNotEmpty(compsByIds)) {
filterComps.addAll(compsByIds);
}
}
List<CompPO> allCompanys = getCompMapper().list("show_order");
new DetachUtil(user.getUID()).filterCompanyList(allCompanys);
Map<Long, CompPO> allMaps = allCompanys.stream().collect(Collectors.toMap(CompPO::getId, item -> item, (k1, k2) -> k1));
Set<CompPO> builderComps = new HashSet<>();
for (CompPO compPO : filterComps) {
buildParentComps(compPO, builderComps,allMaps);
}
return SearchTreeUtil.builderTreeMode(CompBO.buildSetToSearchTree(builderComps), searchTrees);
}
private List<SearchTree> buildTreeByDeptAndJob(DepartmentPO departmentBuild, JobPO jobBuild) {
List<JobPO> jobPOS = getJobMapper().listPOsByFilter(jobBuild);
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild, "show_order");
// 添加父级岗位
Set<JobPO> builderJobs = new HashSet<>();
for (JobPO jobPO : jobPOS) {
buildParentJobs(jobPO, builderJobs);
}
// 添加岗位的上级部门或分部
List<SearchTree> jobTrees = SearchTreeUtil.builderTreeMode(JobBO.buildSetToSearchTree(builderJobs));
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();
int ceilCount = (int) Math.ceil((double) ids.size() / 1000);
List<DepartmentPO> departmentsByIds = new ArrayList<>();
for (int i = 0; i < ceilCount - 1; i++) {
List<DepartmentPO> departmentsById = getDepartmentMapper().getDeptsByIds(PageUtil.subList(i, 1000, ids));
if (CollectionUtils.isNotEmpty(departmentsById)) {
departmentsByIds.addAll(departmentsById);
}
}
if (CollectionUtils.isNotEmpty(departmentsByIds)) {
filterDeparts.addAll(departmentsByIds);
}
}
// 查询分部信息
Set<DepartmentPO> builderDeparts = new HashSet<>();
for (DepartmentPO departmentPO : filterDeparts) {
buildParentDepts(departmentPO, builderDeparts);
}
return SearchTreeUtil.builderTreeMode(DepartmentBO.buildSetToSearchTree(builderDeparts, false), jobTrees);
}
private void buildParentJobs(JobPO jobPO, Set<JobPO> builderJobs) {
builderJobs.add(jobPO);
if (SearchTreeUtil.isTop(jobPO.getParentJob())) {
return;
}
JobPO parentJob = getJobMapper().getJobById(jobPO.getParentJob());
if (null != parentJob) {
buildParentJobs(parentJob, builderJobs);
}
}
/**
*
*
* @param departmentPO
* @param builderDeparts
*/
private void buildParentDepts(DepartmentPO departmentPO, Set<DepartmentPO> builderDeparts) {
builderDeparts.add(departmentPO);
if (SearchTreeUtil.isTop(departmentPO.getParentDept())) {
return;
}
DepartmentPO parentDept = getDepartmentMapper().getDeptById(departmentPO.getParentDept());
if (null != parentDept) {
buildParentDepts(parentDept, builderDeparts);
}
}
/**
*
*
* @param compPO
* @param builderComps
*/
private void buildParentComps(CompPO compPO, Set<CompPO> builderComps,Map<Long, CompPO> allMaps) {
builderComps.add(compPO);
CompPO parentComp = allMaps.get(compPO.getParentCompany());
if (null != parentComp) {
buildParentComps(parentComp, builderComps,allMaps);
}
}
private void completeParams(Map<String, Object> params) {
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("ec_department", jobById.getEcDepartment());
params.put("ec_company", jobById.getEcCompany());
// 等级方案、岗位序列、职等、职级
params.put("scheme_id", jobById.getSchemeId());
params.put("sequence_id", jobById.getSequenceId());
params.put("job_level", jobById.getLevelId());
params.put("job_grade", jobById.getGradeId());
String showOrder = Util.null2String(params.get("show_order"));
// 初始化排序字段
if (StringUtils.isBlank(showOrder)) {
Long orderNum = getHrmResourceMapper().getMaxShowOrder();
params.put("show_order", null == orderNum ? 1 : orderNum + 1);
}
// 人员状态
String status = Util.null2String(params.get("status"));
if(StringUtils.isBlank(status)){
params.put("status", "0");
}
}
}
/**
*
*
* @return
*/
public static String repeatDetermine(String workCode) {
CodeRulePO codeRuleByType = MapperProxyFactory.getProxy(CodeRuleMapper.class).getCodeRuleByType(RuleCodeType.USER.getValue());
if (StringUtils.isNotBlank(workCode)) {
workCode = CodeRuleUtil.generateCode(RuleCodeType.USER, workCode);
List<HrmResourcePO> list = getResourceMapper().listByNo(Util.null2String(workCode));
OrganizationAssert.isEmpty(list, "编号不允许重复");
} else {
if (null != codeRuleByType && "1".equals(codeRuleByType.getSerialEnable())) {
workCode = autoCreateWorkCode();
}
}
return workCode;
}
/**
*
*
* @return
*/
private static String autoCreateWorkCode() {
String generateCode = CodeRuleUtil.generateCode(RuleCodeType.USER, "");
List<HrmResourcePO> list = getResourceMapper().listByNo(Util.null2String(generateCode));
if (CollectionUtils.isNotEmpty(list)) {
generateCode = autoCreateWorkCode();
}
return generateCode;
}
}

@ -16,10 +16,10 @@ 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.CusFormFieldPO;
import com.engine.organization.entity.jclimport.po.JclImportHistoryDetailPO;
import com.engine.organization.entity.jclimport.po.JclImportHistoryPO;
import com.engine.organization.entity.jclimport.vo.JclImportHistoryDetailVO;
import com.engine.organization.entity.job.po.JobPO;
import com.engine.organization.enums.LogModuleNameEnum;
import com.engine.organization.enums.OperateTypeEnum;
import com.engine.organization.enums.OrgImportEnum;
@ -27,18 +27,22 @@ import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.mapper.extend.ExtMapper;
import com.engine.organization.mapper.extend.ExtendInfoMapper;
import com.engine.organization.mapper.hrmresource.HrmResourceMapper;
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
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.service.ImportCommonService;
import com.engine.organization.thread.*;
import com.engine.organization.thread.CompanyTriggerRunnable;
import com.engine.organization.thread.DepartmentTriggerRunnable;
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;
import com.engine.organization.util.excel.ExcelUtil;
import com.engine.organization.util.relation.EcHrmRelationUtil;
import com.engine.organization.util.saveimport.hrmimport.HrmImportAdaptExcelE9;
import com.engine.organization.util.saveimport.hrmimport.HrmImportProcessE9;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.xssf.usermodel.XSSFCell;
@ -46,11 +50,13 @@ import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.common.DateUtil;
import weaver.file.FileUploadToPath;
import weaver.file.ImageFileManager;
import weaver.general.BaseBean;
import weaver.general.GCONST;
import weaver.general.Util;
import weaver.hrm.definedfield.HrmFieldManager;
import weaver.join.hrm.in.HrmResourceVo;
import weaver.systeminfo.SystemEnv;
import javax.servlet.http.HttpServletRequest;
@ -79,7 +85,6 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
private static final String RIGHT_NAME = "DataImport:All";
private static final String HRM_COMPANY = "hrmsubcompany";
private static final String HRM_DEPARTMENT = "hrmdepartment";
private static final String HRM_RESOURCE = "hrmresource";
private ExtendInfoMapper getExtendInfoMapper() {
@ -120,11 +125,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
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");
tableName = "hrmResource";
break;
default:
errorMsg = "未找到对应的导入类型,请确认";
@ -138,14 +139,42 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
return returnMaps;
}
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().listFields(extendType, "", tableName, ExtendInfoOperateType.LIST.getValue(), "1");
List<ExtendInfoPO> filterList = infoPOList.stream().filter(item -> !excludeFields.contains(item.getFieldName()) && 6 != item.getControlType()).collect(Collectors.toList());
List<FieldTransferParam> fieldDatas = filterList.stream().map(item -> FieldTransferParam.builder().id(item.getId().toString()).name(item.getFieldNameDesc()).build()).collect(Collectors.toList());
//fieldDatas.addAll(0, includeFields);
List<String> selectedKeys = filterList.stream().filter(item -> (0 == item.getIsSystemDefault()) && 1 == item.getIsrequired()).map(item -> item.getId().toString()).collect(Collectors.toList());
//selectedKeys.addAll(0, selectedList);
returnMaps.put("data", fieldDatas);
returnMaps.put("selectedKeys", selectedKeys);
if ("4".equals(extendType)) {
String voField = "subcompanyid1,departmentid," +
"workcode,lastname,loginid,password,seclevel,sex," +
// "jobtitle,jobactivity,jobgroupid,jobcall,joblevel," +
"jobactivitydesc,managerid,assistantid,status," +
"workroom,locationid,telephone,mobile,mobilecall," +
"fax,email,systemlanguage,birthday,folk," +
"nativeplace,regresidentplace,certificatenum," +
"maritalstatus,policy,bememberdate,bepartydate," +
"islabouunion,educationlevel,degree,healthinfo,height," +
"weight,usekind,startdate,enddate,probationenddate," +
"residentplace,homeaddress,tempresidentnumber," +
"companystartdate,workstartdate," +
"accumfundaccount,accounttype,belongto,height,weight,accountname,bankid1,accountid1," +
"telephone,dsporder,classification";
Collection<String> hrmFields = Arrays.asList(voField.split(","));
// 获取人员表单字段
List<CusFormFieldPO> hrmFieldBeanList = getSystemDataMapper().getHrmFieldBeanListByFields(hrmFields);
List<CusFormFieldPO> customFieldList = getSystemDataMapper().getHrmCustomFieldList();
List<CusFormFieldPO> mergeList = new ArrayList<>();
mergeList.addAll(hrmFieldBeanList);
mergeList.addAll(customFieldList);
List<FieldTransferParam> fieldDatas = mergeList.stream().map(item -> FieldTransferParam.builder().id(item.getScopeId() + item.getTableName() + item.getFieldId()).name(item.getFieldLabel()).build()).collect(Collectors.toList());
List<String> selectedKeys = mergeList.stream().filter(item -> ("1".equals(item.getRequired()) || "workcode".equals(item.getFieldName()) || "subcompanyid1".equals(item.getFieldName()) || "departmentid".equals(item.getFieldName()))).map(item -> item.getScopeId() + item.getTableName() + item.getFieldId()).collect(Collectors.toList());
returnMaps.put("data", fieldDatas);
returnMaps.put("selectedKeys", selectedKeys);
} else {
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().listFields(extendType, "", tableName, ExtendInfoOperateType.LIST.getValue(), "1");
List<ExtendInfoPO> filterList = infoPOList.stream().filter(item -> !excludeFields.contains(item.getFieldName()) && 6 != item.getControlType()).collect(Collectors.toList());
List<FieldTransferParam> fieldDatas = filterList.stream().map(item -> FieldTransferParam.builder().id(item.getId().toString()).name(item.getFieldNameDesc()).build()).collect(Collectors.toList());
List<String> selectedKeys = filterList.stream().filter(item -> (0 == item.getIsSystemDefault()) && 1 == item.getIsrequired()).map(item -> item.getId().toString()).collect(Collectors.toList());
returnMaps.put("data", fieldDatas);
returnMaps.put("selectedKeys", selectedKeys);
}
return returnMaps;
}
@ -203,29 +232,25 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
returnMap.put("pId", jobImport(operateType, excelFile));
break;
case "resource":
//Long importHistoryId = saveImportLog("resource", operateType);
//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());
// }
//}
//returnMap.put("pId", importHistoryId);
returnMap.put("pId", hrmResourceImport(operateType, excelFile,keyField));
Long importHistoryId = saveImportLog("resource", operateType);
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());
}
}
returnMap.put("pId", importHistoryId);
break;
default:
break;
@ -480,11 +505,11 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
//重复验证字段
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())));
statusOptions.add(new SearchConditionOption("lastname", SystemEnv.getHtmlLabelName(413, user.getLanguage())));
statusOptions.add(new SearchConditionOption("workcode", 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");
searchConditionItem.setValue("lastname");
itemList.add(searchConditionItem);
//导入类型
@ -1199,252 +1224,6 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
return importHistoryId;
}
private Long hrmResourceImport(String operateType, String excelFile, String keyField) {
Long importHistoryId = saveImportLog("resource", operateType);
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);
// 组装待处理数据
Map<String, Object> map = new HashMap<>();
Long parentCompanyId = null;
Long 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) {
// 首行 初始化字段信息
ExtendInfoPO extendInfoPO = getExtendInfoMapper().getInfoByExtendAndLabelName(RESOURCE_TYPE, cellValue);
extendInfoPOS.add(extendInfoPO);
} else {
ExtendInfoPO infoPO = extendInfoPOS.get(cellIndex);
// 数据校验
if (infoPO.getIsrequired() == 1 && StringUtils.isBlank(cellValue)) {
historyDetailPO.setOperateDetail(infoPO.getFieldNameDesc() + "为必填项");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
continue nextRow;
}
Object reallyValue;
try {
reallyValue = getReallyValue(infoPO, cellValue);
} catch (Exception e) {
historyDetailPO.setOperateDetail(cellValue + "转换失败");
historyDetailPO.setStatus("0");
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");
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");
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");
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");
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");
saveImportDetailLog(historyDetailPO);
continue nextRow;
}
}
}
}
if ("job_title".equals(infoPO.getFieldName())) {
if (null == parentCompanyId) {
historyDetailPO.setOperateDetail(cellValue + "所属分部未找到");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
continue nextRow;
}
String[] split = cellValue.split(">");
if (split.length > 0) {
if (split.length > 8) {
historyDetailPO.setOperateDetail("岗位层级不能大于10");
historyDetailPO.setStatus("0");
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");
saveImportDetailLog(historyDetailPO);
continue nextRow;
}
}
}
map.put("company_id", parentCompanyId);
map.put("department_id", parentDepartmentId);
map.put("ec_company", EcHrmRelationUtil.getEcCompanyId(Util.null2String(parentCompanyId)));
if (null != parentDepartmentId) {
map.put("ec_department", EcHrmRelationUtil.getEcDepartmentId(Util.null2String(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");
saveImportDetailLog(historyDetailPO);
continue;
}
historyDetailPO.setRelatedName(keyFieldValue);
// 判断当前人员是否存在
Long resourceId = MapperProxyFactory.getProxy(HrmResourceMapper.class).getIdByKeyField(keyField, keyFieldValue);
if ("add".equals(operateType)) {
if (resourceId != null) {
historyDetailPO.setOperateDetail(keyFieldValue+"已存在");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
continue;
}
// 自动编号
String workCode = Util.null2String(map.get("work_code"));
try {
// 自动编号
workCode = HrmResourceServiceImpl.repeatDetermine(workCode);
map.put("work_code", workCode);
} catch (Exception e) {
historyDetailPO.setOperateDetail(Util.null2String(e.getMessage()));
historyDetailPO.setStatus("0");
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(HrmResourceMapper.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 (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");
}
saveImportDetailLog(historyDetailPO);
} else if ("update".equals(operateType)) {
// 查询对应ID
if (resourceId == null) {
historyDetailPO.setOperateDetail("未找到对应数据");
historyDetailPO.setStatus("0");
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 (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");
}
saveImportDetailLog(historyDetailPO);
}
}
return importHistoryId;
}
/**
*
@ -1498,7 +1277,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
} else {
try {
object = new BigDecimal(cellValue).toPlainString();
}catch (NumberFormatException ignore){
} catch (NumberFormatException ignore) {
object = cellValue;
}
}
@ -1600,7 +1379,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
iterator.remove();
}
if ("所属部门".equals(column) || "上级部门".equals(column)) {
if ("所属部门".equals(column) || "上级部门".equals(column) || "部门".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;
@ -40,7 +39,6 @@ import com.engine.organization.mapper.extend.ExtMapper;
import com.engine.organization.mapper.extend.ExtendTitleMapper;
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
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.service.ExtService;
import com.engine.organization.service.JobService;
@ -50,7 +48,6 @@ import com.engine.organization.thread.OrganizationSyncEc;
import com.engine.organization.util.*;
import com.engine.organization.util.coderule.CodeRuleUtil;
import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.detach.DetachUtil;
import com.engine.organization.util.page.Column;
import com.engine.organization.util.page.PageInfo;
import com.engine.organization.util.page.PageUtil;
@ -129,9 +126,6 @@ public class JobServiceImpl extends Service implements JobService {
return MapperProxyFactory.getProxy(ExtendTitleMapper.class);
}
private ResourceMapper getResourceMapper() {
return MapperProxyFactory.getProxy(ResourceMapper.class);
}
private ExtService getExtService(User user) {
return ServiceUtil.getService(ExtServiceImpl.class, user);
@ -165,12 +159,10 @@ public class JobServiceImpl extends Service implements JobService {
PageInfo<JobListDTO> pageInfos;
String orderSql = PageInfoSortUtil.getSortSql(param.getSortParams());
List<JobListDTO> allList = getJobMapper().listNoFilter(orderSql);
new DetachUtil(user.getUID()).filterJobDTOList(allList);
// 通过子级遍历父级元素
if (filter) {
// 根据条件获取元素
List<JobListDTO> filterJobPOs = getJobMapper().listByFilter(jobPO, orderSql);
new DetachUtil(user.getUID()).filterJobDTOList(allList);
// 添加父级元素
List<JobListDTO> jobListDTOS = JobBO.buildJobDTOList(allList, filterJobPOs);
List<JobListDTO> subList = PageUtil.subList(param.getCurrent(), param.getPageSize(), jobListDTOS);
@ -523,7 +515,16 @@ 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");
RecordSet rs = new RecordSet();
List<String> ids = new ArrayList<>();
rs.executeQuery("select id from cus_fielddata where field100002 = ?", jobId);
while (rs.next()) {
ids.add(Util.null2String(rs.getString("id")));
}
if (CollectionUtils.isEmpty(ids)) {
ids.add("-1");
}
table.setSqlwhere(" where id in (" + StringUtils.join(ids, ",") + ") and status<4");
WeaResultMsg result = new WeaResultMsg(false);
result.putAll(table.makeDataResult());
result.success();
@ -689,10 +690,8 @@ public class JobServiceImpl extends Service implements JobService {
*/
private List<SearchTree> buildTreeByCompAndDept(DepartmentPO departmentBuild, CompPO compBuild) {
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild, "show_order");
new DetachUtil(user.getUID()).filterDepartmentList(filterDeparts);
// 查询分部信息
List<CompPO> filterComps = getCompMapper().listByFilter(compBuild, "show_order");
new DetachUtil(user.getUID()).filterCompanyList(filterComps);
Set<DepartmentPO> builderDeparts = new HashSet<>();
for (DepartmentPO departmentPO : filterDeparts) {
buildParentDepts(departmentPO, builderDeparts);
@ -707,7 +706,6 @@ public class JobServiceImpl extends Service implements JobService {
}
}
List<CompPO> allCompanys = getCompMapper().list("show_order");
new DetachUtil(user.getUID()).filterCompanyList(allCompanys);
Map<Long, CompPO> allMaps = allCompanys.stream().collect(Collectors.toMap(CompPO::getId, item -> item, (k1, k2) -> k1));
Set<CompPO> builderComps = new HashSet<>();
for (CompPO compPO : filterComps) {
@ -880,18 +878,15 @@ public class JobServiceImpl extends Service implements JobService {
// 更新岗位下的人员
Long originalJobId = originalJob.getId();
Long targetJobId = targetJob.getId();
Long parentComp = targetJob.getParentComp();
Long parentDept = targetJob.getParentDept();
Long ecCompany = targetJob.getEcCompany();
Long 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();
RecordSet rs = new RecordSet();
if(!originalJobId.equals(targetJobId)){
rs.executeUpdate("update cus_fielddata set field100002 = ? where scope = 'hrmcustomfieldbyinfotype' and scopeid = -1 and field100002 = ?", targetJobId, originalJobId);
}
rs.executeQuery("select id from cus_fielddata where scope = 'hrmcustomfieldbyinfotype' and scopeid = -1 and field100002 = ?",targetJobId);
while (rs.next()) {
Long resourceId = Long.parseLong(rs.getString("id"));
new HrmResourceTriggerRunnable(resourceId).run();
}
}

@ -0,0 +1,507 @@
package com.engine.organization.service.impl;
import cn.hutool.core.convert.Convert;
import com.engine.core.impl.Service;
import com.engine.organization.entity.jingyou.*;
import com.engine.organization.service.OrgChartService;
import com.engine.organization.util.HasRightUtil;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.hrm.User;
import java.util.*;
/**
* @className: OrgChartServiceImpl
* @author: dengjp
* @date: 2022/7/7
* @description: ServiceImpl
**/
public class JyChartServiceImpl extends Service implements OrgChartService {
private static final String COMPANY_RIGHT = "OrgChart:All";
private static final String USER_RIGHT = "OrgPerspective:All";
RecordSet rs = new RecordSet();
@Override
public Map<String, Object> getOptionCondition(Map<String, Object> request2Map, User user) {
Map<String, Object> result = new HashMap<>();
rs.executeQuery("select id, companyname from HrmCompanyVirtual order by id");
List<Map<String, Object>> fclasslist = new ArrayList<>();
Map<String, Object> defaultItem = new HashMap<>();
defaultItem.put("id", "0");
defaultItem.put("companyname", "行政维度");
fclasslist.add(defaultItem);
while (rs.next()) {
Map<String, Object> item = new HashMap<>();
item.put("id", rs.getString("id"));
item.put("companyname", rs.getString("companyname"));
fclasslist.add(item);
}
// 集团数据
String sql = "select concat('c_',id) as id, companyname as fname from hrmcompany";
rs.executeQuery(sql);
Set<JyOrgSelectItem> companySet = new HashSet<>();
while (rs.next()) {
JyOrgSelectItem item = new JyOrgSelectItem();
item.setId("0");
//item.setFnumber(rs.getString("fnumber"));
item.setFname(rs.getString("fname"));
companySet.add(item);
}
// 分部数据
sql = "select concat('s_',id) as id,subcompanyname as fname, subcompanycode as fnumber from hrmsubcompany where ifnull(canceled,'0')='0' order by showorder ,showOrderOfTree";
rs.executeQuery(sql);
while (rs.next()) {
JyOrgSelectItem item = new JyOrgSelectItem();
item.setId(rs.getString("id"));
item.setFnumber(rs.getString("fnumber"));
item.setFname(rs.getString("fname"));
companySet.add(item);
}
result.put("api_status", true);
result.put("fclasslist", fclasslist);
result.put("companylist", companySet);
return result;
}
@Override
public Map<String, Object> getCompanyData(Map<String, Object> request2Map, User user) {
Map<String, Object> result = new HashMap<>();
boolean hasRight = HasRightUtil.hasRight(user, COMPANY_RIGHT, true);
result.put("hasRight", hasRight);
if (!hasRight) {
return result;
}
// 根节点
String root = (String) request2Map.get("root");
// 显示层级
String level = (String) request2Map.get("level");
int currentLevel = Convert.toInt(level, 3);
// 维度
String fclass = (String) request2Map.get("fclass");
// 当前维度
boolean currentDimension = "0".equals(fclass);
String fisvitual = (String) request2Map.get("fisvitual"); // 是否显示虚拟组织
if (StringUtils.isBlank(fisvitual)) {
fisvitual = "0";
}
Set<JyChart> chartList = new LinkedHashSet<>();
if (currentDimension) {
if ("0".equals(root)) {
// 集团
rs.executeQuery("select * from hrmcompany");
if (rs.next()) {
JyChart item = new JyChart();
item.setId("0");
item.setFname(rs.getString("companyname"));
item.setFtype("0");
item.setFnumber(rs.getString("companycode"));
item.setFecid(rs.getString("id"));
item.setUuid(rs.getString("uuid"));
item.setFisvitual("0");
item.setExpand("1");
chartList.add(item);
buildSubCompanyData(item.getFecid(), "0", item.getId(), currentLevel, chartList);
}
} else if (root.startsWith("s_")) {
// 分部
String chartId = getChartId(root);
rs.executeQuery("select * from hrmsubcompany where id = ?", chartId);
if (rs.next()) {
JyChart item = new JyChart();
item.setId("s_" + rs.getString("id"));
item.setFname(rs.getString("subcompanyname"));
item.setFtype("1");
item.setFnumber(rs.getString("subcompanycode"));
item.setFecid(rs.getString("id"));
item.setUuid(rs.getString("uuid"));
item.setFisvitual("0");
item.setExpand("1");
chartList.add(item);
buildSubCompanyData(rs.getString("companyid"), item.getFecid(), item.getId(), currentLevel, chartList);
buildDepartmentData(item.getFecid(), "0", item.getId(), currentLevel, chartList);
}
}
}
result.put("api_status", true);
result.put("data", chartList);
return result;
}
@Override
public Map<String, Object> asyncCompanyData(Map<String, Object> request2Map, User user) {
String ids = (String) request2Map.get("ids");
Set<JyChart> chartList = new LinkedHashSet<>();
if (StringUtils.isNotBlank(ids)) {
String[] splitIds = ids.split(",");
for (String splitId : splitIds) {
if (splitId.startsWith("s_")) {
// 分部
String chartId = getChartId(splitId);
rs.executeQuery("select * from hrmsubcompany where id = ?", chartId);
if (rs.next()) {
JyChart item = new JyChart();
item.setId("s_" + rs.getString("id"));
item.setParentId(splitId);
item.setFname(rs.getString("subcompanyname"));
item.setFtype("1");
item.setFnumber(rs.getString("subcompanycode"));
item.setFecid(rs.getString("id"));
item.setUuid(rs.getString("uuid"));
item.setFisvitual("0");
item.setExpand("0");
chartList.add(item);
buildSubCompanyData(rs.getString("companyid"), item.getFecid(), item.getId(), 0, chartList);
buildDepartmentData(item.getFecid(), "0", item.getId(), 0, chartList);
}
} else if (splitId.startsWith("d_")) {
// 分部
String chartId = getChartId(splitId);
rs.executeQuery("select * from hrmdepartment where id = ?", chartId);
if (rs.next()) {
JyChart jyChart = new JyChart();
jyChart.setId("d_" + rs.getString("id"));
jyChart.setParentId(splitId);
jyChart.setFname(rs.getString("departmentmark"));
jyChart.setFtype("2");
jyChart.setFnumber(rs.getString("departmentcode"));
jyChart.setFecid(rs.getString("id"));
jyChart.setUuid(rs.getString("uuid"));
jyChart.setFisvitual("0");
jyChart.setExpand("0");
chartList.add(jyChart);
String subCompanyId = rs.getString("subcompanyid1");
buildDepartmentData(subCompanyId, jyChart.getFecid(), jyChart.getId(), 0, chartList);
}
}
}
}
Map<String, Object> result = new HashMap<>();
result.put("api_status", true);
result.put("data", chartList);
return result;
}
@Override
public Map<String, Object> getUserData(Map<String, Object> request2Map, User user) {
Map<String, Object> result = new HashMap<>();
boolean hasRight = HasRightUtil.hasRight(user, USER_RIGHT, true);
result.put("hasRight", hasRight);
if (!hasRight) {
return result;
}
String root = (String) request2Map.get("root"); // 根节点
String level = (String) request2Map.get("level"); // 显示层级
int currentLevel = Convert.toInt(level, 3);
// 维度
String fclass = (String) request2Map.get("fclass");
// 当前维度
boolean currentDimension = "0".equals(fclass);
String fisvitual = (String) request2Map.get("fisvitual"); // 是否显示虚拟组织
if (StringUtils.isBlank(fisvitual)) {
fisvitual = "0";
}
Set<JyChart> chartList = new LinkedHashSet<>();
if (currentDimension) {
if ("0".equals(root)) {
// 集团
rs.executeQuery("select * from hrmcompany");
if (rs.next()) {
JyCompanyChart item = new JyCompanyChart();
item.setId("0");
item.setFname(rs.getString("companyname"));
item.setFtype("0");
item.setFnumber(rs.getString("companycode"));
item.setFecid(rs.getString("id"));
item.setUuid(rs.getString("uuid"));
item.setFisvitual("0");
item.setExpand("1");
chartList.add(item);
buildSubCompanyUserData(item.getFecid(), "0", item.getId(), currentLevel, chartList);
}
} else if (root.startsWith("s_")) {
// 分部
String chartId = getChartId(root);
rs.executeQuery("select * from hrmsubcompany where id = ?", chartId);
if (rs.next()) {
JySubCompanyChart item = new JySubCompanyChart();
item.setId("s_" + rs.getString("id"));
item.setFname(rs.getString("subcompanyname"));
item.setFtype("1");
item.setFnumber(rs.getString("subcompanycode"));
item.setFecid(rs.getString("id"));
item.setUuid(rs.getString("uuid"));
item.setFisvitual("0");
item.setExpand("1");
chartList.add(item);
buildSubCompanyUserData(rs.getString("companyid"), item.getFecid(), item.getId(), currentLevel, chartList);
buildDepartmentUserData(item.getFecid(), "0", item.getId(), currentLevel, chartList);
}
}
}
result.put("api_status", true);
result.put("data", chartList);
return result;
}
@Override
public Map<String, Object> asyncUserData(Map<String, Object> request2Map, User user) {
String ids = (String) request2Map.get("ids");
Set<JyChart> chartList = new LinkedHashSet<>();
if (StringUtils.isNotBlank(ids)) {
String[] splitIds = ids.split(",");
for (String splitId : splitIds) {
if (splitId.startsWith("s_")) {
// 分部
String chartId = getChartId(splitId);
rs.executeQuery("select * from hrmsubcompany where id = ?", chartId);
if (rs.next()) {
JySubCompanyChart item = new JySubCompanyChart();
item.setId("s_" + rs.getString("id"));
item.setParentId(splitId);
item.setFname(rs.getString("subcompanyname"));
item.setFtype("1");
item.setFnumber(rs.getString("subcompanycode"));
item.setFecid(rs.getString("id"));
item.setUuid(rs.getString("uuid"));
item.setFisvitual("0");
item.setExpand("0");
chartList.add(item);
buildSubCompanyUserData(rs.getString("companyid"), item.getFecid(), item.getId(), 0, chartList);
buildDepartmentUserData(item.getFecid(), "0", item.getId(), 0, chartList);
}
} else if (splitId.startsWith("d_")) {
// 部门
String chartId = getChartId(splitId);
rs.executeQuery("select * from hrmdepartment where id = ?", chartId);
if (rs.next()) {
JyDepartmentChart jyChart = new JyDepartmentChart();
jyChart.setId("d_" + rs.getString("id"));
jyChart.setParentId(splitId);
jyChart.setFname(rs.getString("departmentmark"));
jyChart.setFtype("2");
jyChart.setFnumber(rs.getString("departmentcode"));
jyChart.setFecid(rs.getString("id"));
jyChart.setUuid(rs.getString("uuid"));
jyChart.setFisvitual("0");
jyChart.setExpand("0");
chartList.add(jyChart);
String subCompanyId = rs.getString("subcompanyid1");
buildDepartmentUserData(subCompanyId, jyChart.getFecid(), jyChart.getId(), 0, chartList);
buildJobUserData(jyChart.getFecid(), jyChart.getId(), 0, chartList);
}
}else if (splitId.startsWith("j_")) {
// 岗位
String chartId = getChartId(splitId);
rs.executeQuery("select * from jcl_org_job where id = ? ", chartId);
if (rs.next()) {
JyJobChart jyChart = new JyJobChart();
jyChart.setId("j_" + rs.getString("id"));
jyChart.setParentId(splitId);
jyChart.setFname(rs.getString("job_name"));
jyChart.setFtype("3");
jyChart.setFnumber(rs.getString("job_no"));
jyChart.setFecid(rs.getString("id"));
jyChart.setUuid(rs.getString("uuid"));
jyChart.setFisvitual("0");
jyChart.setExpand("0");
chartList.add(jyChart);
buildResourceUserData(jyChart.getFecid(), jyChart.getId(), 0, chartList);
}
}
}
}
Map<String, Object> result = new HashMap<>();
result.put("api_status", true);
result.put("data", chartList);
return result;
}
void buildSubCompanyData(String companyId, String parentId, String chartPid, int currentLevel, Set<JyChart> chartList) {
if (currentLevel < 0) {
return;
}
rs.executeQuery("select * from hrmsubcompany where companyid = " + companyId + " and ifnull(supsubcomid,0) = " + parentId + " and ifnull(canceled,0) = 0 order by showorder ,showOrderOfTree");
List<JyChart> subCompanyList = new ArrayList<>();
while (rs.next()) {
JyChart item = new JyChart();
item.setId("s_" + rs.getString("id"));
item.setParentId(chartPid);
item.setFname(rs.getString("subcompanyname"));
item.setFtype("1");
item.setFnumber(rs.getString("subcompanycode"));
item.setFecid(rs.getString("id"));
item.setUuid(rs.getString("uuid"));
item.setFisvitual("0");
item.setExpand(currentLevel > 0 ? "1" : "0");
subCompanyList.add(item);
}
chartList.addAll(subCompanyList);
for (JyChart jyChart : subCompanyList) {
buildSubCompanyData(companyId, jyChart.getFecid(), jyChart.getId(), currentLevel - 1, chartList);
buildDepartmentData(jyChart.getFecid(), "0", jyChart.getId(), currentLevel - 1, chartList);
}
}
void buildDepartmentData(String subCompanyId, String parentId, String chartPid, int currentLevel, Set<JyChart> chartList) {
if (currentLevel < 0) {
return;
}
rs.executeQuery("select * from hrmdepartment where subcompanyid1 = " + subCompanyId + " and ifnull(supdepid,0) = " + parentId + " and ifnull(canceled,0) = 0 order by showorder ,showorderoftree");
List<JyChart> departmentList = new ArrayList<>();
while (rs.next()) {
JyChart item = new JyChart();
item.setId("d_" + rs.getString("id"));
item.setParentId(chartPid);
item.setFname(rs.getString("departmentmark"));
item.setFtype("2");
item.setFnumber(rs.getString("departmentcode"));
item.setFecid(rs.getString("id"));
item.setUuid(rs.getString("uuid"));
item.setFisvitual("0");
item.setExpand(currentLevel > 0 ? "1" : "0");
departmentList.add(item);
}
chartList.addAll(departmentList);
for (JyChart jyChart : departmentList) {
buildDepartmentData(subCompanyId, jyChart.getFecid(), jyChart.getId(), currentLevel - 1, chartList);
}
}
void buildSubCompanyUserData(String companyId, String parentId, String chartPid, int currentLevel, Set<JyChart> chartList) {
if (currentLevel < 0) {
return;
}
rs.executeQuery("select * from hrmsubcompany where companyid = " + companyId + " and ifnull(supsubcomid,0) = " + parentId + " and ifnull(canceled,0) = 0 order by showorder ,showOrderOfTree");
List<JySubCompanyChart> subCompanyList = new ArrayList<>();
while (rs.next()) {
JySubCompanyChart item = new JySubCompanyChart();
item.setId("s_" + rs.getString("id"));
item.setParentId(chartPid);
item.setFname(rs.getString("subcompanyname"));
item.setFtype("1");
item.setFnumber(rs.getString("subcompanycode"));
item.setFecid(rs.getString("id"));
item.setUuid(rs.getString("uuid"));
item.setFisvitual("0");
item.setExpand(currentLevel > 0 ? "1" : "0");
subCompanyList.add(item);
}
chartList.addAll(subCompanyList);
for (JySubCompanyChart jyChart : subCompanyList) {
buildSubCompanyUserData(companyId, jyChart.getFecid(), jyChart.getId(), currentLevel - 1, chartList);
buildDepartmentUserData(jyChart.getFecid(), "0", jyChart.getId(), currentLevel - 1, chartList);
}
}
void buildDepartmentUserData(String subCompanyId, String parentId, String chartPid, int currentLevel, Set<JyChart> chartList) {
if (currentLevel < 0) {
return;
}
String sql = "select * from hrmdepartment where subcompanyid1 = " + subCompanyId + " and ifnull(supdepid,0) = " + parentId + " and ifnull(canceled,0) = 0 order by showorder ,showorderoftree";
rs.executeQuery(sql);
List<JyDepartmentChart> departmentList = new ArrayList<>();
while (rs.next()) {
JyDepartmentChart item = new JyDepartmentChart();
item.setId("d_" + rs.getString("id"));
item.setParentId(chartPid);
item.setFname(rs.getString("departmentmark"));
item.setFtype("2");
item.setFnumber(rs.getString("departmentcode"));
item.setFecid(rs.getString("id"));
item.setUuid(rs.getString("uuid"));
item.setFisvitual("0");
item.setExpand(currentLevel > 0 ? "1" : "0");
departmentList.add(item);
}
chartList.addAll(departmentList);
for (JyDepartmentChart jyChart : departmentList) {
buildDepartmentUserData(subCompanyId, jyChart.getFecid(), jyChart.getId(), currentLevel - 1, chartList);
buildJobUserData(jyChart.getFecid(), jyChart.getId(), currentLevel - 1, chartList);
}
}
void buildJobUserData(String departmentId, String chartPid, int currentLevel, Set<JyChart> chartList) {
if (currentLevel < 0) {
return;
}
rs.executeQuery("select * from jcl_org_job where ec_department = ? and ifnull(forbidden_tag,0)=0 and ifnull(delete_type,0)=0 order by show_order ", departmentId);
List<JyJobChart> jobList = new ArrayList<>();
while (rs.next()) {
JyJobChart item = new JyJobChart();
item.setId("j_" + rs.getString("id"));
item.setParentId(chartPid);
item.setFname(rs.getString("job_name"));
item.setFtype("3");
item.setFnumber(rs.getString("job_no"));
item.setFecid(rs.getString("id"));
item.setUuid(rs.getString("uuid"));
item.setFisvitual("0");
item.setExpand(currentLevel > 0 ? "1" : "0");
jobList.add(item);
}
chartList.addAll(jobList);
for (JyJobChart jyChart : jobList) {
// 查询人员
buildResourceUserData(jyChart.getFecid(), jyChart.getId(), currentLevel - 1, chartList);
}
}
void buildResourceUserData(String jobId, String chartPid, int currentLevel, Set<JyChart> chartList) {
if (currentLevel < 0) {
return;
}
rs.executeQuery("select a.id,a.lastname from hrmresource a inner join cus_fielddata b on a.id = b.id and b.scope ='hrmcustomfieldbyinfotype' and b.scopeid ='-1' where a.status < 4 and b.field100002 = ?", jobId);
List<JyResourceChart> resourceList = new ArrayList<>();
while (rs.next()) {
JyResourceChart item = new JyResourceChart();
item.setId("r_" + rs.getString("id"));
item.setParentId(chartPid);
item.setFname(rs.getString("lastname"));
item.setFtype("4");
item.setFnumber(rs.getString("hrmresource"));
item.setFecid(rs.getString("id"));
item.setUuid(rs.getString("uuid"));
item.setFisvitual("0");
item.setExpand(currentLevel > 0 ? "1" : "0");
resourceList.add(item);
}
chartList.addAll(resourceList);
}
public static String getChartId(String id) {
if (StringUtils.isNotBlank(id)) {
String[] split = id.split("_");
if (split.length == 2) {
return split[1];
}
}
return "";
}
}

@ -1,192 +0,0 @@
package com.engine.organization.service.impl;
import com.api.browser.bean.BrowserBean;
import com.api.browser.bean.SearchConditionGroup;
import com.api.browser.bean.SearchConditionItem;
import com.api.browser.bean.SearchConditionOption;
import com.cloudstore.eccom.result.WeaResultMsg;
import com.engine.core.impl.Service;
import com.engine.organization.component.OrganizationWeaTable;
import com.engine.organization.entity.DeleteParam;
import com.engine.organization.entity.detach.param.ManagerDetachParam;
import com.engine.organization.entity.detach.po.ManagerDetachPO;
import com.engine.organization.entity.detach.vo.ManagerDetachVO;
import com.engine.organization.mapper.detach.ManagerDetachMapper;
import com.engine.organization.mapper.employee.EmployeeMapper;
import com.engine.organization.mapper.hrmresource.HrmResourceMapper;
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
import com.engine.organization.service.ManagerDetachService;
import com.engine.organization.util.HasRightUtil;
import com.engine.organization.util.OrganizationFormItemUtil;
import com.engine.organization.util.db.DBType;
import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.relation.EcHrmRelationUtil;
import com.weaver.file.ConfigOperator;
import com.weaver.general.BaseBean;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @Author weaver_cl
* @Description:
* @Date 2022/10/21
* @Version V1.0
**/
public class ManagerDetachServiceImpl extends Service implements ManagerDetachService {
private static final String RIGHT_NAME = "MangerDeatch:All";
public ManagerDetachMapper getMangeDetachMapper() {
return MapperProxyFactory.getProxy(ManagerDetachMapper.class);
}
public HrmResourceMapper getHrmResourceMapper() {
return MapperProxyFactory.getProxy(HrmResourceMapper.class);
}
public EmployeeMapper getEmployeeMapper() {
return MapperProxyFactory.getProxy(EmployeeMapper.class);
}
public SystemDataMapper getSystemDataMapper(){
return MapperProxyFactory.getProxy(SystemDataMapper.class);
}
@Override
public Map<String, Object> listPage(Map<String, Object> params) {
Map<String, Object> resultMap = new HashMap<>();
boolean hasRight = HasRightUtil.hasRight(user, RIGHT_NAME, true);
resultMap.put("hasRight", hasRight);
if (!hasRight) {
return resultMap;
}
String detach = new BaseBean().getPropValue("hrmOrganization", "detach");
resultMap.put("isDetach",detach);
OrganizationWeaTable<ManagerDetachVO> table = new OrganizationWeaTable<>(user, ManagerDetachVO.class);
String sqlWhere = buildSqlWhere(params);
table.setSqlwhere(sqlWhere);
WeaResultMsg result = new WeaResultMsg(false);
result.putAll(table.makeDataResult());
result.success();
resultMap.putAll(result.getResultMap());
return resultMap;
}
@Override
public Map<String, Object> getForm(Integer id) {
Map<String, Object> apiDatas = new HashMap<>();
List<SearchConditionItem> selectItems = new ArrayList<>();
List<SearchConditionGroup> addGroups = new ArrayList<>();
List<SearchConditionOption> selectOptions = new ArrayList<>();
SearchConditionOption moduleOption = new SearchConditionOption("0", "组织管理",true);
selectOptions.add(moduleOption);
SearchConditionItem ecManager = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, true, "管理员", "1", "ecManager", "");
ecManager.setRules("required|string");
SearchConditionItem ecRolelevel = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, false, "可维护机构", "194", "ecRolelevel", "");
ecRolelevel.setRules("required|string");
SearchConditionItem module = OrganizationFormItemUtil.selectItem(user, selectOptions, 2, 16, 6, false, "可管理模块", "module");
module.setViewAttr(1);
module.setDetailtype(2);
module.setHasBorder(true);
if (id != null) {
ManagerDetachPO detachById = getMangeDetachMapper().getDetachById(id);
BrowserBean manager = ecManager.getBrowserConditionParam();
manager.setReplaceDatas(getEmployeeMapper().getBrowserDatas(DeleteParam.builder().ids(String.valueOf(detachById.getEcManager())).build().getIds()));
ecManager.setBrowserConditionParam(manager);
BrowserBean roleLevel = ecRolelevel.getBrowserConditionParam();
roleLevel.setReplaceDatas(getSystemDataMapper().getBrowserDatas(DeleteParam.builder().ids(String.valueOf(detachById.getEcRolelevel())).build().getIds()));
ecRolelevel.setBrowserConditionParam(roleLevel);
}
selectItems.add(ecManager);
selectItems.add(ecRolelevel);
selectItems.add(module);
addGroups.add(new SearchConditionGroup("基本信息", true, selectItems));
apiDatas.put("condition", addGroups);
return apiDatas;
}
@Override
public int deleteByIds(Collection<Long> ids) {
return getMangeDetachMapper().deleteByIds(ids);
}
@Override
public int save(ManagerDetachParam param) {
ManagerDetachPO managerDetachPO = ManagerDetachPO.builder()
.managerType(0)
.ecManager(param.getEcManager())
.jclManager(getHrmResourceMapper().getJclResourceId(String.valueOf(param.getEcManager())).intValue())
.ecRolelevel(param.getEcRolelevel())
.jclRolelevel(EcHrmRelationUtil.getBatchJclCompanyId(param.getEcRolelevel()) != null ? String.valueOf(EcHrmRelationUtil.getBatchJclCompanyId(param.getEcRolelevel())) : null)
.manageModule("组织管理")
.creator((long)user.getUID())
.deleteType(0)
.createTime(new Date())
.updateTime(new Date())
.build();
return getMangeDetachMapper().insertIgnoreNull(managerDetachPO);
}
@Override
public int updateDetach(ManagerDetachParam param) {
ManagerDetachPO managerDetachPO = ManagerDetachPO.builder()
.id(param.getId())
.ecManager(param.getEcManager())
.jclManager(getHrmResourceMapper().getJclResourceId(String.valueOf(param.getEcManager())).intValue())
.ecRolelevel(param.getEcRolelevel())
.jclRolelevel(EcHrmRelationUtil.getBatchJclCompanyId(param.getEcRolelevel()) != null ? String.valueOf(EcHrmRelationUtil.getBatchJclCompanyId(param.getEcRolelevel())) : null)
.build();
return getMangeDetachMapper().updateDetach(managerDetachPO);
}
@Override
public String doDetach(String isDetach) {
ConfigOperator ConfigOperator = new ConfigOperator();
ConfigOperator.setProp("hrmOrganization.properties", "detach", isDetach);
return new BaseBean().getPropValue("hrmOrganization", "detach");
}
private String buildSqlWhere(Map<String, Object> params) {
DBType dbType = DBType.get(new RecordSet().getDBType());
String sqlWhere = " where delete_type = 0";
String lastName = (String) params.get("ecManager");
List<Long> resourceIds = MapperProxyFactory.getProxy(EmployeeMapper.class).getResourceIds(lastName);
String ecManager = StringUtils.join(resourceIds,",");
if (StringUtils.isNotBlank(lastName)) {
sqlWhere += " AND ec_manager in ("+ecManager+") ";
}
String ecRolelevel = (String) params.get("ecRolelevel");
if (StringUtils.isNotBlank(ecRolelevel)) {
sqlWhere += " AND " + dbType.concat("ec_rolelevel") + dbType.like(ecRolelevel);
}
return sqlWhere;
}
/**
* JCL_ID
* @param uId
* @return
*/
public static List<Long> getJclRoleLevels(Integer uId) {
List<Long> ecRoleLevels = new ArrayList<>();
ManagerDetachMapper mangeDetachMapper = MapperProxyFactory.getProxy(ManagerDetachMapper.class);
List<ManagerDetachPO> detachListById = mangeDetachMapper.getDetachListById(uId);
for (ManagerDetachPO managerDetachPO : detachListById) {
List<Long> ids = Stream.of(managerDetachPO.getJclRolelevel().split(",")).map(Long::parseLong).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(ids)) {
ecRoleLevels.addAll(ids);
}
}
return ecRoleLevels;
}
}

@ -2,6 +2,7 @@ package com.engine.organization.service.impl;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.organization.entity.scheme.po.GradePO;
import com.engine.organization.entity.scheme.po.LevelPO;
@ -11,7 +12,6 @@ import com.engine.organization.service.OrgChartService;
import com.engine.organization.util.HasRightUtil;
import com.engine.organization.util.db.DBType;
import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.detach.DetachUtil;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.Util;
@ -33,8 +33,18 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
private static final String COMPANY_RIGHT = "OrgChart:All";
private static final String USER_RIGHT = "OrgPerspective:All";
boolean isCustom = true;
private JyChartServiceImpl getJyChartService(User user) {
return ServiceUtil.getService(JyChartServiceImpl.class, user);
}
@Override
public Map<String, Object> getOptionCondition(Map<String, Object> request2Map, User user) {
if(isCustom){
return getJyChartService(user).getOptionCondition(request2Map, user);
}
Map<String, Object> result = new HashMap<>();
RecordSet rs = new RecordSet();
@ -52,28 +62,18 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
}
String sql = "select distinct id, fnumber, fname, ftype from jcl_org_map where ftype in (0, 1) order by ftype , id ";
// 分部分权过滤
DetachUtil detachUtil = new DetachUtil(user.getUID());
if (detachUtil.isDETACH()) {
String jclRoleLevels = detachUtil.getJclRoleLevels();
if (StringUtils.isNotBlank(jclRoleLevels)) {
sql = "select distinct id, fnumber, fname, ftype from jcl_org_map where (ftype = 0 or (ftype = 1 and fobjid in(" + jclRoleLevels + "))) order by ftype , id";
} else {
sql = "select distinct id, fnumber, fname, ftype from jcl_org_map where ftype = 0 order by ftype , id";
}
}
rs.executeQuery(sql);
List<Map<String, Object>> companylist = new ArrayList<>();
Set<OrgSelectItem> companySet = new HashSet<>();
while (rs.next()) {
Map<String, Object> item = new HashMap<>();
item.put("id", rs.getString("id"));
item.put("fnumber", rs.getString("fnumber"));
item.put("fname", rs.getString("fname"));
companylist.add(item);
OrgSelectItem item = new OrgSelectItem();
item.setId(rs.getString("id"));
item.setFnumber(rs.getString("fnumber"));
item.setFname(rs.getString("fname"));
companySet.add(item);
}
result.put("api_status", true);
result.put("fclasslist", fclasslist);
result.put("companylist", companylist);
result.put("companylist", companySet);
return result;
}
@ -111,6 +111,9 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
@Override
public Map<String, Object> getCompanyData(Map<String, Object> request2Map, User user) {
if(isCustom){
return getJyChartService(user).getCompanyData(request2Map, user);
}
Map<String, Object> result = new HashMap<>();
boolean hasRight = HasRightUtil.hasRight(user, COMPANY_RIGHT, true);
result.put("hasRight", hasRight);
@ -156,7 +159,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
findCompanyItemByParantId(id, currentLevel + 1, level, rs, list, whereSql, currentLevel + 1 <= Integer.parseInt(level));
// 分部数据,构建层级关系
reBuildTreeList(list);
reBuildTreeList(list, root);
result.put("api_status", true);
result.put("data", list);
@ -165,16 +168,8 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
private void findCompanyItemByParantId(String id, int currentLevel, String level, RecordSet rs, List<Map<String, Object>> list, String whereSql, boolean expand) {
String sql = "select id, fname, ftype, fparentid,fobjid,fecid,fnumber,fisvitual from jcl_org_map " + whereSql;
DetachUtil detachUtil = new DetachUtil(user.getUID());
if (detachUtil.isDETACH()) {
if ("0".equals(id)) {
sql += " and ftype = 1 and fobjid in(" + detachUtil.getJclRoleLevels() + ")";
} else {
sql += " and fparentid = " + id + " and ftype !=1";
}
} else {
sql += " and fparentid = " + id;
}
sql += " and fparentid = " + id;
rs.executeQuery(sql);
List<Map<String, Object>> currentList = new ArrayList<>();
while (rs.next()) {
@ -258,7 +253,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
// 获取根节点
RecordSet rs = new RecordSet();
rs.executeQuery("select t.id, t.fname, t.ftype, t.fparentid, t.fleadername,t.fobjid,t.fecid, t.fleaderimg, t.fleaderjob, t.fplan, t.fonjob, t.fnumber, t.fleader, t.fleaderlv, t.fleaderst, t.fecid, t.fisvitual from jcl_org_map t " + whereSql + whereItemSql);
rs.executeQuery("select t.id, t.fname, t.ftype, t.fparentid, t.fleadername,t.fobjid,t.fecid, t.fleaderimg, t.fleaderjob, t.fleaderjobid, t.fplan, t.fonjob, t.fnumber, t.fleader, t.fleaderlv, t.fleaderst, t.fecid, t.fisvitual from jcl_org_map t " + whereSql + whereItemSql);
List<Map<String, Object>> list = new ArrayList<>();
String id = null;
if (rs.next()) {
@ -268,15 +263,23 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
item.put("fname", rs.getString("fname"));
item.put("ftype", rs.getString("ftype"));
item.put("parentId", null);
item.put("fleadername", rs.getString("fleadername"));
item.put("fleaderimg", rs.getString("fleaderimg"));
item.put("fleaderjob", rs.getString("fleaderjob"));
item.put("fplan", rs.getString("fplan"));
item.put("fonjob", rs.getString("fonjob"));
if ("0".equals(id)) {
item.put("fleadername", "");
item.put("fleaderimg", "");
item.put("fleaderjob", "");
item.put("fleader", "");
} else {
item.put("fleadername", rs.getString("fleadername"));
item.put("fleaderimg", rs.getString("fleaderimg"));
item.put("fleaderjob", rs.getString("fleaderjob"));
item.put("fleader", rs.getString("fleader"));
}
// 转换岗位
item.put("fplan", StringUtils.isNotEmpty(rs.getString("fplan")) ? rs.getString("fplan") : "0");
item.put("fonjob", StringUtils.isNotEmpty(rs.getString("fonjob")) ? rs.getString("fonjob") : "0");
item.put("hasChildren", hasChildren(rs.getString("id"), false));
item.put("expand", "1");
item.put("fnumber", rs.getString("fnumber"));
item.put("fleader", rs.getString("fleader"));
item.put("fobjid", rs.getString("fobjid"));
item.put("fleaderlv", convertLevel(rs.getString("fleaderlv")));
item.put("fleaderst", convertGrade(rs.getString("fleaderst")));
@ -289,7 +292,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
findUserItemByParantId(id, currentLevel + 1, level, rs, list, whereSql, currentLevel + 1 <= Integer.parseInt(level));
// 分部数据,构建层级关系
reBuildTreeList(list);
reBuildTreeList(list, root);
result.put("api_status", true);
result.put("data", list);
@ -304,7 +307,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
whereSql += " and fparentid in (" + ids + ") ";
RecordSet rs = new RecordSet();
rs.executeQuery("select t.id, t.fname, t.ftype, t.fparentid, t.fleadername, t.fleaderimg, t.fleaderjob, t.fplan, t.fonjob, t.fnumber, t.fleader,t.fleaderlv, t.fleaderst,t.fobjid,t.fisvitual from jcl_org_map t " + whereSql);
rs.executeQuery("select t.id, t.fname, t.ftype, t.fparentid, t.fleadername, t.fleaderimg, t.fleaderjob, t.fleaderjobid, t.fplan, t.fonjob, t.fnumber, t.fleader,t.fleaderlv, t.fleaderst,t.fobjid,t.fisvitual from jcl_org_map t " + whereSql);
List<Map<String, Object>> currentList = new ArrayList<>();
while (rs.next()) {
Map<String, Object> item = new HashMap<>();
@ -314,9 +317,11 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
item.put("parentId", rs.getString("fparentid"));
item.put("fleadername", rs.getString("fleadername"));
item.put("fleaderimg", rs.getString("fleaderimg"));
// 转换岗位
//item.put("fleaderjob", convertJobNameById(rs.getString("fleaderjobid")));
item.put("fleaderjob", rs.getString("fleaderjob"));
item.put("fplan", rs.getString("fplan"));
item.put("fonjob", rs.getString("fonjob"));
item.put("fplan", StringUtils.isNotEmpty(rs.getString("fplan")) ? rs.getString("fplan") : "0");
item.put("fonjob", StringUtils.isNotEmpty(rs.getString("fonjob")) ? rs.getString("fonjob") : "0");
item.put("fnumber", rs.getString("fnumber"));
item.put("hasChildren", hasChildren(rs.getString("id"), false));
item.put("fleader", rs.getString("fleader"));
@ -327,21 +332,6 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
currentList.add(item);
}
//for (Map<String, Object> stringObjectMap : currentList) {
// if ("4".equals(stringObjectMap.get("ftype"))) { // 员工信息
// rs.executeQuery("select id, mobile, home_address from jcl_org_hrmresource where id = ? ", stringObjectMap.get("fobjid"));
// if (rs.next()) {
// stringObjectMap.put("mobile", rs.getString("mobile"));
// stringObjectMap.put("address", rs.getString("home_address"));
// }
// rs.executeQuery("select dept_name from jcl_org_hrmresource hrm left join jcl_org_dept d on hrm.department_id = d.id where hrm.id =? ", stringObjectMap.get("fobjid"));
// if (rs.next()) {
// stringObjectMap.put("department", rs.getString("dept_name"));
// }
//
// }
//}
Map<String, Object> result = new HashMap<>();
result.put("api_status", true);
result.put("data", currentList);
@ -350,6 +340,9 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
@Override
public Map<String, Object> asyncCompanyData(Map<String, Object> request2Map, User user) {
if(true){
return getJyChartService(user).asyncCompanyData(request2Map, user);
}
String ids = (String) request2Map.get("ids");
String whereSql = companyDateWhereSql(request2Map);
@ -379,17 +372,9 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
private void findUserItemByParantId(String id, int currentLevel, String level, RecordSet rs, List<Map<String, Object>> list, String whereSql, boolean expand) {
String sql = "select t.id, t.fname, t.ftype, t.fparentid, t.fobjparentid, t.fleader, t.fleadername, t.fleaderimg, t.fleaderjob, t.fplan, t.fonjob, t.fnumber, t.fobjid, t.fecid, t.fleaderlv, t.fleaderst, t.fisvitual from jcl_org_map t " + whereSql;
DetachUtil detachUtil = new DetachUtil(user.getUID());
if (detachUtil.isDETACH()) {
if ("0".equals(id)) {
sql += " and t.ftype = 1 and t.fobjid in(" + detachUtil.getJclRoleLevels() + ")";
} else {
sql += " and t.fparentid = " + id + " and t.ftype !=1";
}
} else {
sql += " and t.fparentid = " + id;
}
String sql = "select t.id, t.fname, t.ftype, t.fparentid, t.fobjparentid, t.fleader, t.fleadername, t.fleaderimg, t.fleaderjob, t.fleaderjobid, t.fplan, t.fonjob, t.fnumber, t.fobjid, t.fecid, t.fleaderlv, t.fleaderst, t.fisvitual from jcl_org_map t " + whereSql;
sql += " and t.fparentid = " + id;
rs.executeQuery(sql);
List<Map<String, Object>> currentList = new ArrayList<>();
while (rs.next()) {
@ -401,9 +386,11 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
item.put("fobjparentId", rs.getString("fobjparentid"));
item.put("fleadername", rs.getString("fleadername"));
item.put("fleaderimg", rs.getString("fleaderimg"));
// 转换岗位
//item.put("fleaderjob", convertJobNameById(rs.getString("fleaderjobid")));
item.put("fleaderjob", rs.getString("fleaderjob"));
item.put("fplan", rs.getString("fplan"));
item.put("fonjob", rs.getString("fonjob"));
item.put("fplan", StringUtils.isNotEmpty(rs.getString("fplan")) ? rs.getString("fplan") : "0");
item.put("fonjob", StringUtils.isNotEmpty(rs.getString("fonjob")) ? rs.getString("fonjob") : "0");
item.put("fnumber", rs.getString("fnumber"));
item.put("expand", expand ? "1" : "0");
item.put("fobjid", rs.getString("fobjid"));
@ -493,14 +480,59 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
}
private void reBuildTreeList(List<Map<String, Object>> list) {
private void reBuildTreeList(List<Map<String, Object>> list, String root) {
// 分部数据,构建层级关系
Set<String> idSet = list.stream().filter(item -> "1".equals(Util.null2String(item.get("ftype")))).map(item -> Util.null2String(item.get("id"))).collect(Collectors.toSet());
list.forEach(item -> {
if ("1".equals(Util.null2String(item.get("ftype"))) && !idSet.contains(Util.null2String(item.get("parentId")))) {
item.put("parentId", "0");
item.put("fobjparentId", "0");
if (!root.equals(Util.null2String(item.get("id"))) && "1".equals(Util.null2String(item.get("ftype"))) && !idSet.contains(Util.null2String(item.get("parentId")))) {
item.put("parentId", root);
item.put("fobjparentId", root);
}
});
}
static class OrgSelectItem {
private String id;
private String fnumber;
private String fname;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getFnumber() {
return fnumber;
}
public void setFnumber(String fnumber) {
this.fnumber = fnumber;
}
public String getFname() {
return fname;
}
public void setFname(String fname) {
this.fname = fname;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof OrgSelectItem) {
OrgSelectItem item = (OrgSelectItem) obj;
return this.getId().equals(item.getId());
}
return false;
}
@Override
public int hashCode() {
return Integer.parseInt(this.getId());
}
}
}

@ -1,20 +1,18 @@
package com.engine.organization.thread;
import com.engine.organization.entity.company.po.CompPO;
import com.engine.organization.entity.hrmresource.po.HrmResourcePO;
import com.engine.organization.entity.job.po.JobPO;
import com.engine.organization.entity.cusfielddata.po.CusFieldData;
import com.engine.organization.entity.map.JclOrgMap;
import com.engine.organization.entity.personnelcard.User;
import com.engine.organization.entity.staff.po.StaffPO;
import com.engine.organization.enums.ModuleTypeEnum;
import com.engine.organization.mapper.comp.CompMapper;
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.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;
@ -61,6 +59,7 @@ public class CompanyTriggerRunnable implements Runnable {
jclMap.setUuid(newCompany.getUuid());
jclMap.setFNumber(newCompany.getCompNo());
jclMap.setFName(newCompany.getCompName());
jclMap.setFLeader(newCompany.getCompPrincipal());
jclMap.setFParentId(null == newCompany.getParentCompany() ? 0 : newCompany.getParentCompany().intValue());
jclMap.setFObjParentId(null == newCompany.getParentCompany() ? 0 : newCompany.getParentCompany().intValue());
jclMap.setFEcId(getCompTriggerMapper().getEcCompanyIdByUuid(jclMap.getUuid()));
@ -68,26 +67,22 @@ public class CompanyTriggerRunnable implements Runnable {
jclMap.setFClass(0);
jclMap.setFClassName("行政维度");
HrmResource hrmResourceById = getCompTriggerMapper().getHrmResourceById(jclMap.getFLeader());
Integer ecResourceId = newCompany.getCompPrincipal();
HrmResourcePO hrmResourcePO = getCompTriggerMapper().getResourceByEcId(ecResourceId);
if (null != hrmResourcePO) {
jclMap.setFLeader(hrmResourcePO.getId().intValue());
jclMap.setFLeaderName(hrmResourcePO.getLastName());
jclMap.setFLeaderJobId(hrmResourcePO.getJobTitle().intValue());
jclMap.setFLeaderSt(hrmResourcePO.getJobGrade());
jclMap.setFLeaderLv(hrmResourcePO.getJobLevel());
String image = User.builder().image(hrmResourcePO.getResourceImageId()).build().getImage();
jclMap.setFLeaderImg(image);
if (null != hrmResourcePO.getJobTitle()) {
JobPO jobById = MapperProxyFactory.getProxy(JobMapper.class).getJobById(hrmResourcePO.getJobTitle());
if (null != jobById) {
jclMap.setFLeaderJob(jobById.getJobName());
}
}
if (null != hrmResourceById) {
jclMap.setFLeaderImg(hrmResourceById.getMessagerurl());
jclMap.setFLeaderName(hrmResourceById.getLastname());
jclMap.setFLeaderJobId(hrmResourceById.getJobtitle());
}
jclMap.setFLeaderJob(getCompTriggerMapper().getJobTitleMarkById(jclMap.getFLeaderJobId()));
CusFieldData cusFieldDataById = getCompTriggerMapper().getCusFieldDataById(jclMap.getFLeader());
if (null != cusFieldDataById) {
jclMap.setFLeaderSt(cusFieldDataById.getField100008());
jclMap.setFLeaderLv(cusFieldDataById.getField100007());
}
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()));

@ -1,28 +1,23 @@
package com.engine.organization.thread;
import com.engine.organization.entity.cusfielddata.po.CusFieldData;
import com.engine.organization.entity.department.po.DepartmentPO;
import com.engine.organization.entity.hrmresource.po.HrmResourcePO;
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.personnelcard.User;
import com.engine.organization.entity.staff.po.StaffPO;
import com.engine.organization.enums.ModuleTypeEnum;
import com.engine.organization.mapper.department.DepartmentMapper;
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.DepartmentTriggerMapper;
import com.engine.organization.util.OrganizationDateUtil;
import com.engine.organization.util.db.MapperProxyFactory;
import org.apache.commons.collections.CollectionUtils;
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.List;
/**
* @author:dxfeng
@ -50,7 +45,7 @@ public class DepartmentTriggerRunnable implements Runnable {
this.newDepartment = newDepartment;
}
public DepartmentTriggerRunnable(Boolean forbiddenTag,DepartmentPO oldDepartment, DepartmentPO newDepartment) {
public DepartmentTriggerRunnable(Boolean forbiddenTag, DepartmentPO oldDepartment, DepartmentPO newDepartment) {
this.oldDepartment = oldDepartment;
this.newDepartment = newDepartment;
this.forbiddenTag = forbiddenTag;
@ -61,7 +56,7 @@ public class DepartmentTriggerRunnable implements Runnable {
this.newDepartment = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptById(departmentId);
}
public DepartmentTriggerRunnable(String moveTarget,DepartmentPO newDepartment) {
public DepartmentTriggerRunnable(String moveTarget, DepartmentPO newDepartment) {
this.oldDepartment = new DepartmentPO();
this.newDepartment = newDepartment;
this.moveTarget = moveTarget;
@ -80,108 +75,100 @@ public class DepartmentTriggerRunnable implements Runnable {
@Override
public void run() {
FieldBaseEquator fieldBaseEquator = new FieldBaseEquator();
List<String> diffFields = fieldBaseEquator.getDiffFieldList(oldDepartment, newDepartment);
if (CollectionUtils.isEmpty(diffFields)) {
return;
}
// 判断
if (diffFields.contains("deptName") || diffFields.contains("deptPrincipal") || diffFields.contains("parentComp") || diffFields.contains("parentDept") || diffFields.contains("forbiddenTag") || diffFields.contains("deleteType")) {
JclOrgMap jclMap = new JclOrgMap();
jclMap.setFType(2);
int st = 100000000;
// 更新逻辑
jclMap.setFObjId(newDepartment.getId().intValue());
jclMap.setId(newDepartment.getId().intValue() + st);
jclMap.setUuid(newDepartment.getUuid());
jclMap.setFNumber(newDepartment.getDeptNo());
jclMap.setFName(newDepartment.getDeptName());
jclMap.setFParentId(null == newDepartment.getParentDept() ? newDepartment.getParentComp().intValue() : newDepartment.getParentDept().intValue() + st);
jclMap.setFObjParentId(null == newDepartment.getParentDept() ? newDepartment.getParentComp().intValue() : newDepartment.getParentDept().intValue());
jclMap.setFEcId(getDepartmentTriggerMapper().getEcDepartmentIdByUuid(jclMap.getUuid()));
jclMap.setFClass(0);
jclMap.setFClassName("行政维度");
Integer ecResourceId = null == newDepartment.getDeptPrincipal() ? null : newDepartment.getDeptPrincipal().intValue();
HrmResourcePO hrmResourcePO = getCompTriggerMapper().getResourceByEcId(ecResourceId);
if (null != hrmResourcePO) {
jclMap.setFLeader(hrmResourcePO.getId().intValue());
jclMap.setFLeaderName(hrmResourcePO.getLastName());
jclMap.setFLeaderJobId(hrmResourcePO.getJobTitle().intValue());
jclMap.setFLeaderSt(hrmResourcePO.getJobGrade());
jclMap.setFLeaderLv(hrmResourcePO.getJobLevel());
String image = User.builder().image(hrmResourcePO.getResourceImageId()).build().getImage();
jclMap.setFLeaderImg(image);
if (null != hrmResourcePO.getJobTitle()) {
JobPO jobById = MapperProxyFactory.getProxy(JobMapper.class).getJobById(hrmResourcePO.getJobTitle());
if (null != jobById) {
jclMap.setFLeaderJob(jobById.getJobName());
}
}
}
JclOrgMap jclMap = new JclOrgMap();
jclMap.setFType(2);
int st = 100000000;
// 更新逻辑
jclMap.setFObjId(newDepartment.getId().intValue());
jclMap.setId(newDepartment.getId().intValue() + st);
jclMap.setUuid(newDepartment.getUuid());
jclMap.setFNumber(newDepartment.getDeptNo());
jclMap.setFName(newDepartment.getDeptName());
jclMap.setFLeader(null == newDepartment.getDeptPrincipal() ? null : newDepartment.getDeptPrincipal().intValue());
jclMap.setFParentId(null == newDepartment.getParentDept() ? newDepartment.getParentComp().intValue() : newDepartment.getParentDept().intValue() + st);
jclMap.setFObjParentId(null == newDepartment.getParentDept() ? newDepartment.getParentComp().intValue() : newDepartment.getParentDept().intValue());
jclMap.setFEcId(getDepartmentTriggerMapper().getEcDepartmentIdByUuid(jclMap.getUuid()));
jclMap.setFClass(0);
jclMap.setFClassName("行政维度");
HrmResource hrmResourceById = getCompTriggerMapper().getHrmResourceById(jclMap.getFLeader());
if (null != hrmResourceById) {
jclMap.setFLeaderImg(hrmResourceById.getMessagerurl());
jclMap.setFLeaderName(hrmResourceById.getLastname());
jclMap.setFLeaderJobId(hrmResourceById.getJobtitle());
}
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.setFLeaderJob(getCompTriggerMapper().getJobTitleMarkById(jclMap.getFLeaderJobId()));
// 获取当前生效的本部门map记录
JclOrgMap jclOrgMapByObjID = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapByObjID(jclMap.getFDateBegin(), ModuleTypeEnum.departmentfielddefined.getValue().toString(), Util.null2String(jclMap.getFObjId()));
StaffPO staffPO = new StaffPO();
switch (jclMap.getFType()) {
// 分部
case 1:
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(1,jclMap.getFObjId().toString(), null, null);
break;
// 部门
case 2:
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(2,null, jclMap.getFObjId().toString(), null);
break;
}
// 取出以该部门为上级部门的在编、在岗数,转移无需计算
JclOrgMap jclOrgMap = MapperProxyFactory.getProxy(JclOrgMapper.class).getSumPlanAndJobByFParentId(jclMap.getFDateBegin(), jclMap.getId().toString());
if (null != moveTarget) {
jclOrgMap = null;
}
if (null != jclOrgMapByObjID) {
if (null != jclOrgMap) {
jclMap.setFPlan((null != staffPO ? staffPO.getStaffNum() : 0) + jclOrgMap.getFPlan());
jclMap.setFOnJob(jclOrgMap.getFOnJob());
} else {
jclMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
jclMap.setFOnJob(jclOrgMapByObjID.getFOnJob());
}
CusFieldData cusFieldDataById = getCompTriggerMapper().getCusFieldDataById(jclMap.getFLeader());
if (null != cusFieldDataById) {
jclMap.setFLeaderSt(cusFieldDataById.getField100008());
jclMap.setFLeaderLv(cusFieldDataById.getField100007());
}
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()));
// 获取当前生效的本部门map记录
JclOrgMap jclOrgMapByObjID = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapByObjID(jclMap.getFDateBegin(), ModuleTypeEnum.departmentfielddefined.getValue().toString(), Util.null2String(jclMap.getFObjId()));
StaffPO staffPO = new StaffPO();
switch (jclMap.getFType()) {
// 分部
case 1:
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(1, jclMap.getFObjId().toString(), null, null);
break;
// 部门
case 2:
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(2, null, jclMap.getFObjId().toString(), null);
break;
}
// 取出以该部门为上级部门的在编、在岗数,转移无需计算
JclOrgMap jclOrgMap = MapperProxyFactory.getProxy(JclOrgMapper.class).getSumPlanAndJobByFParentId(jclMap.getFDateBegin(), jclMap.getId().toString());
if (null != moveTarget) {
jclOrgMap = null;
}
if (null != jclOrgMapByObjID) {
if (null != jclOrgMap) {
jclMap.setFPlan((null != staffPO ? staffPO.getStaffNum() : 0) + jclOrgMap.getFPlan());
jclMap.setFOnJob(jclOrgMap.getFOnJob());
} else {
jclMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
jclMap.setFOnJob(0);
jclMap.setFOnJob(jclOrgMapByObjID.getFOnJob());
}
jclMap.setFIsVitual(0);
} 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);
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 != newDepartment.getDeleteType() && 1 != newDepartment.getForbiddenTag()) {
MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(jclMap);
}
if(null != jclOrgMapByObjID) {
updateParentPlanAndJob(jclMap.getFDateBegin(), jclOrgMapByObjID.getFParentId().toString());
}
// 部门启用,刷新上级数据
if(forbiddenTag){
updateParentPlanAndJob(jclMap.getFDateBegin(), jclMap.getFParentId().toString());
}
if(null != moveTarget){
updateParentPlanAndJob(jclMap.getFDateBegin(), moveTarget);
}
if (null != oldFparentId) {
updateParentPlanAndJob(jclMap.getFDateBegin(), oldFparentId);
}
if (1 != newDepartment.getDeleteType() && 1 != newDepartment.getForbiddenTag()) {
MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(jclMap);
}
if (null != jclOrgMapByObjID) {
updateParentPlanAndJob(jclMap.getFDateBegin(), jclOrgMapByObjID.getFParentId().toString());
}
// 部门启用,刷新上级数据
if (forbiddenTag) {
updateParentPlanAndJob(jclMap.getFDateBegin(), jclMap.getFParentId().toString());
}
if (null != moveTarget) {
updateParentPlanAndJob(jclMap.getFDateBegin(), moveTarget);
}
if (null != oldFparentId) {
updateParentPlanAndJob(jclMap.getFDateBegin(), oldFparentId);
}
}
@ -194,7 +181,7 @@ public class DepartmentTriggerRunnable implements Runnable {
StaffPO staffPO = new StaffPO();
switch (parentJclOrgMap.getFType()) {
case 1:
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(1,Util.null2String(parentJclOrgMap.getFObjId()), null, null);
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(1, Util.null2String(parentJclOrgMap.getFObjId()), null, null);
break;
// 部门
case 2:
@ -202,10 +189,10 @@ public class DepartmentTriggerRunnable implements Runnable {
break;
}
// 编制表jcl_org_staff中的编制数+下级编制数,工具类判断
if(null != jclOrgMapSum){
if (null != jclOrgMapSum) {
parentJclOrgMap.setFPlan((null != staffPO ? staffPO.getStaffNum() : 0) + jclOrgMapSum.getFPlan());
parentJclOrgMap.setFOnJob(jclOrgMapSum.getFOnJob());
}else{
} else {
parentJclOrgMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
parentJclOrgMap.setFOnJob(0);
}

@ -1,6 +1,5 @@
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;
@ -59,11 +58,6 @@ public class GroupTriggerRunnable implements Runnable {
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());

@ -1,17 +1,15 @@
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.cusfielddata.po.CusFieldData;
import com.engine.organization.entity.map.JclOrgMap;
import com.engine.organization.entity.personnelcard.User;
import com.engine.organization.mapper.hrmresource.HrmResourceMapper;
import com.engine.organization.mapper.jclorgmap.JclOrgMapper;
import com.engine.organization.mapper.job.JobMapper;
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 org.apache.commons.lang.StringUtils;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.hrm.passwordprotection.domain.HrmResource;
import java.sql.Date;
@ -32,9 +30,7 @@ public class HrmResourceTriggerRunnable implements Runnable {
private HrmResourceTriggerMapper getHrmResourceTriggerMapper() {
return MapperProxyFactory.getProxy(HrmResourceTriggerMapper.class);
}
private HrmResourceMapper getHrmResourceMapper() {
return MapperProxyFactory.getProxy(HrmResourceMapper.class);
}
private JclOrgMapper getJclOrgMapper() {
return MapperProxyFactory.getProxy(JclOrgMapper.class);
}
@ -51,38 +47,36 @@ public class HrmResourceTriggerRunnable implements Runnable {
Integer delete = null;
JclOrgMap jclMap = new JclOrgMap();
jclMap.setFType(4);
// 当前日期 yyyy-MM-dd
String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date());
// 查询当前人员信息数据
String ecResourceId = getHrmResourceMapper().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 = User.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());
HrmResource hrmResource = getHrmResourceTriggerMapper().getHrmResource(userId);
if (null != hrmResource) {
jclMap.setFObjId(hrmResource.getId());
jclMap.setId(hrmResource.getId() + sk);
jclMap.setFNumber(hrmResource.getWorkcode());
jclMap.setFName(hrmResource.getLastname());
delete = hrmResource.getStatus() <= 3 ? 0 : 1;
jclMap.setFLeaderImg(hrmResource.getMessagerurl());
// 更新组织架构图,组织架构负责人头像
RecordSet rs = new RecordSet();
rs.executeUpdate("update jcl_org_map set fleaderimg = ? where fleader =? and fdateend > ?", hrmResource.getMessagerurl(), hrmResource.getId(), currentDate);
jclMap.setFLeaderName(hrmResource.getLastname());
jclMap.setFLeaderJobId(hrmResource.getJobtitle());
String field100002 = getHrmResourceTriggerMapper().getField100002(jclMap.getFObjId());
if (StringUtils.isNotBlank(field100002)) {
jclMap.setFObjParentId(Integer.parseInt(field100002));
jclMap.setFParentId(jclMap.getFObjParentId() + sj);
}
jclMap.setFLeaderSt(hrmResource.getJobGrade());
jclMap.setFLeaderLv(hrmResource.getJobLevel());
CusFieldData cusFieldDataById = getHrmResourceTriggerMapper().getCusFieldDataById(jclMap.getFObjId());
if (null != cusFieldDataById) {
jclMap.setFLeaderSt(cusFieldDataById.getField100008());
jclMap.setFLeaderLv(cusFieldDataById.getField100007());
}
jclMap.setFClass(0);
jclMap.setFClassName("行政维度");
String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date());
jclMap.setFLeaderJob(getCompTriggerMapper().getJobTitleMarkById(jclMap.getFLeaderJobId()));
jclMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
jclMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
jclMap.setFIsVitual(0);

@ -1,7 +1,6 @@
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;
@ -12,12 +11,11 @@ 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 weaver.general.Util;
import java.sql.Date;
import java.util.Calendar;
import java.util.List;
/**
* @author:dxfeng
@ -67,11 +65,6 @@ public class JobTriggerRunnable implements Runnable {
@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;
@ -132,7 +125,7 @@ public class JobTriggerRunnable implements Runnable {
getCompTriggerMapper().deleteMap(jclMap.getFType(), jclMap.getFObjId(), jclMap.getFDateBegin());
getCompTriggerMapper().updateMap(jclMap.getFType(), jclMap.getFObjId(), jclMap.getFDateBegin(), time);
if (1 != newJob.getDeleteType() && 1 != newJob.getForbiddenTag()) {
if (!"1".equals(Util.null2String(newJob.getDeleteType())) && !"1".equals(Util.null2String(newJob.getForbiddenTag()))) {
MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(jclMap);
}
if (null != jclOrgMapByObjID) {

@ -16,7 +16,6 @@ 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 org.apache.commons.lang.StringUtils;
import weaver.general.Util;
@ -36,7 +35,7 @@ import java.util.stream.Collectors;
public class OrganizationSyncEc {
private final LogModuleNameEnum moduleName;
private final OperateTypeEnum operateType;
private Map<String, Object> params;
private final Map<String, Object> params;
private final User user;
private JobPO oldJobPO;
Map<String, Object> resultMap;
@ -90,7 +89,6 @@ public class OrganizationSyncEc {
refreshJob();
break;
case RESOURCE:
refreshResource();
default:
break;
}
@ -155,29 +153,8 @@ public class OrganizationSyncEc {
}
}
private void refreshResource(){
switch (operateType) {
case ADD:
addResource();
break;
case UPDATE:
updateResource();
break;
case CANCELED:
default:
break;
}
}
private void addResource() {
Map<String, Object> convertParams = ResourceSyncUtil.convertEcResourceParams(params);
this.resultMap = ResourceSyncUtil.addResource(user, convertParams);
}
private void updateResource() {
Map<String, Object> convertParams = ResourceSyncUtil.convertEcResourceParams(params);
this.resultMap = ResourceSyncUtil.editResourceBase(user, convertParams);
}
/**

@ -0,0 +1,170 @@
package com.engine.organization.trigger.cusfielddata;
import com.engine.organization.entity.commom.RecordInfo;
import com.engine.organization.entity.cusfielddata.po.CusFieldData;
import com.engine.organization.entity.extend.param.ExtendInfoParams;
import com.engine.organization.entity.job.po.JobPO;
import com.engine.organization.entity.postion.po.PostInfoPO;
import com.engine.organization.entity.postion.po.PostPO;
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.entity.sequence.po.SequencePO;
import com.engine.organization.mapper.extend.ExtMapper;
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.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.util.db.MapperProxyFactory;
import com.wbi.util.Util;
import org.apache.commons.lang3.StringUtils;
import java.util.HashMap;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2022/08/01
* @version: 1.0
*/
public class CusFieldDataTrigger {
public static void run(Long id) {
if (null == id) {
// 查询人员表最新插入的ID
id = MapperProxyFactory.getProxy(SystemDataMapper.class).getHrmResourceMaxId();
if (null == id) {
return;
}
}
boolean updateFlag = false;
// 查询当前操作的数据
CusFieldData sourceData = MapperProxyFactory.getProxy(SystemDataMapper.class).getHrmCusFieldDataByIdAndScopeId(id, -1L);
String sourceField100001 = sourceData.getField100001();
String sourceField100002 = sourceData.getField100002();
String sourceField100003 = sourceData.getField100003();
// 查询需要更新的数据,没有则创建数据
CusFieldData directionData = MapperProxyFactory.getProxy(SystemDataMapper.class).getHrmCusFieldDataByIdAndScopeId(id, 3L);
if (null == directionData) {
directionData = new CusFieldData();
directionData.setScope("HrmCustomFieldByInfoType");
directionData.setScopeId(3L);
directionData.setId(id);
MapperProxyFactory.getProxy(SystemDataMapper.class).insertCusFieldData(directionData);
}
// field100002更新
if (StringUtils.isNotBlank(sourceField100002)) {
directionData.setField100002(sourceField100002);
Long gwId = Long.parseLong(sourceField100002);
JobPO jobById = MapperProxyFactory.getProxy(JobMapper.class).getJobById(gwId);
if (null != jobById) {
RecordInfo hrmJobTitleByName = MapperProxyFactory.getProxy(SystemDataMapper.class).getHrmJobTitleByName(jobById.getJobName());
if(null!=hrmJobTitleByName) {
Long ecGwId = StringUtils.isNotBlank(hrmJobTitleByName.getId()) ? Long.parseLong(hrmJobTitleByName.getId()) : null;
Long ecBmId = jobById.getEcDepartment();
Long ecGsId = jobById.getEcCompany();
Map<String, Object> hrmResourceMap = new HashMap<>();
// 岗位
hrmResourceMap.put("jobtitle", ecGwId);
// 部门
hrmResourceMap.put("departmentid", ecBmId);
// 公司
hrmResourceMap.put("subcompanyid1", ecGsId);
MapperProxyFactory.getProxy(ExtMapper.class).updateTable(ExtendInfoParams.builder().id(id).tableName("hrmresource").params(hrmResourceMap).build());
updateFlag = true;
// 职等职级为空,从岗位取值、更新
if (StringUtils.isBlank(sourceField100001)) {
if (StringUtils.isNotBlank(jobById.getLevelId())) {
// 通过岗位关联,如有多个职等,选取第一个
String[] levelArray = jobById.getLevelId().split(",");
LevelPO levelByID = MapperProxyFactory.getProxy(LevelMapper.class).getLevelByID(Long.parseLong(levelArray[0]));
directionData.setField100008(levelByID.getLevelName());
} else {
directionData.setField100008(null);
}
// 职等职级方案
if (StringUtils.isNotBlank(Util.null2String(jobById.getSchemeId()))) {
SchemePO schemeByID = MapperProxyFactory.getProxy(SchemeMapper.class).getSchemeByID(jobById.getSchemeId());
directionData.setField100006(schemeByID.getSchemeName());
} else {
directionData.setField100006(null);
}
// 职级
if (StringUtils.isNotBlank(jobById.getGradeId())) {
GradePO gradeByLevelId = MapperProxyFactory.getProxy(GradeMapper.class).getGradeByID(Long.parseLong(jobById.getGradeId()));
directionData.setField100007(gradeByLevelId.getGradeName());
} else {
directionData.setField100007(null);
}
// 岗位序列
if (StringUtils.isNotBlank(Util.null2String(jobById.getSequenceId()))) {
SequencePO sequenceBySchemeId = MapperProxyFactory.getProxy(SequenceMapper.class).getSequenceByID(jobById.getSequenceId());
directionData.setField100005(sequenceBySchemeId.getSequenceName());
} else {
directionData.setField100005(null);
}
}
}
}
} else {
directionData.setField100002(null);
directionData.setField100008(null);
directionData.setField100006(null);
directionData.setField100007(null);
directionData.setField100005(null);
}
// field100001更新,职等职级
if (null != sourceField100001 && sourceField100001.split("A").length == 3) {
directionData.setField100001(sourceField100001);
String[] field100001Array = sourceField100001.split("A");
// 职等
long zdId = Long.parseLong(field100001Array[2]);
long zjId = Long.parseLong(field100001Array[1]);
long xlId = Long.parseLong(field100001Array[0].split("_")[1]);
LevelPO levelByID = MapperProxyFactory.getProxy(LevelMapper.class).getLevelByID(zdId);
directionData.setField100008(levelByID.getLevelName());
// 职等职级方案
SchemePO schemeByID = MapperProxyFactory.getProxy(SchemeMapper.class).getSchemeByID(levelByID.getSchemeId());
directionData.setField100006(schemeByID.getSchemeName());
// 职级
GradePO gradeByLevelId = MapperProxyFactory.getProxy(GradeMapper.class).getGradeByID(zjId);
directionData.setField100007(gradeByLevelId.getGradeName());
// 岗位序列
SequencePO sequenceBySchemeId = MapperProxyFactory.getProxy(SequenceMapper.class).getSequenceByID(xlId);
directionData.setField100005(sequenceBySchemeId.getSequenceName());
updateFlag = true;
}
if (null != sourceField100003 && sourceField100003.split("_").length == 2) {
directionData.setField100003(sourceField100003);
String[] field100003Array = sourceField100003.split("_");
long zwId = Long.parseLong(field100003Array[1]);
// 职务
PostInfoPO postInfoByID = MapperProxyFactory.getProxy(PostInfoMapper.class).getPostInfoByID(zwId);
directionData.setField100010(postInfoByID.getPostInfoName());
// 职务分类
PostPO postByID = MapperProxyFactory.getProxy(PostMapper.class).getPostByID(postInfoByID.getPostId());
directionData.setField100009(postByID.getPostName());
updateFlag = true;
}
// 更新数据
if (updateFlag) {
MapperProxyFactory.getProxy(SystemDataMapper.class).updateCusFieldData(directionData);
}
// 刷新组织结构图
// new HrmResourceTriggerRunnable(id).run();
}
}

@ -1,79 +0,0 @@
package com.engine.organization.util.detach;
import com.engine.organization.entity.company.po.CompPO;
import com.engine.organization.entity.department.po.DepartmentPO;
import com.engine.organization.entity.job.dto.JobListDTO;
import com.engine.organization.entity.job.po.JobPO;
import com.engine.organization.service.impl.ManagerDetachServiceImpl;
import com.weaver.general.BaseBean;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.List;
/**
* @author:dxfeng
* @createTime: 2022/10/28
* @version: 1.0
*/
public class DetachUtil {
private boolean DETACH = "true".equals(new BaseBean().getPropValue("hrmOrganization", "detach"));
private final List<Long> jclRoleLevels;
public DetachUtil(Integer uId) {
if (1 == uId) {
DETACH = false;
}
if (DETACH) {
jclRoleLevels = ManagerDetachServiceImpl.getJclRoleLevels(uId);
} else {
jclRoleLevels = new ArrayList<>();
}
}
/**
*
*/
public void filterCompanyList(List<CompPO> companyList) {
if (DETACH && CollectionUtils.isNotEmpty(companyList)) {
companyList.removeIf(item -> !jclRoleLevels.contains(item.getId()));
}
}
/**
*
*/
public void filterDepartmentList(List<DepartmentPO> departmentList) {
if (DETACH && CollectionUtils.isNotEmpty(departmentList)) {
departmentList.removeIf(item -> !jclRoleLevels.contains(item.getParentComp()));
}
}
/**
*
*/
public void filterJobDTOList(List<JobListDTO> jobList) {
if (DETACH && CollectionUtils.isNotEmpty(jobList)) {
jobList.removeIf(item -> !jclRoleLevels.contains(item.getParentComp()));
}
}
/**
*
*/
public void filterJobList(List<JobPO> jobList) {
if (DETACH && CollectionUtils.isNotEmpty(jobList)) {
jobList.removeIf(item -> !jclRoleLevels.contains(item.getParentComp()));
}
}
public String getJclRoleLevels() {
return StringUtils.join(jclRoleLevels, ",");
}
public boolean isDETACH() {
return DETACH;
}
}

@ -14,7 +14,7 @@ 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.trigger.cusfielddata.CusFieldDataTrigger;
import com.engine.organization.util.db.MapperProxyFactory;
import com.weaver.integration.ldap.sync.oa.OaSync;
import com.weaver.integration.ldap.util.AuthenticUtil;
@ -780,8 +780,7 @@ public class HrmImportProcessE9 extends BaseBean {
flag = false;
if (updateWorkData(vo.getWorkFields(), vo.getWorkFieldsValue(), id)) //添加工作字段信息
flag = false;
// TODO 更新聚才林相关字段
// CusFieldDataTrigger.run((long) id);
CusFieldDataTrigger.run((long) id);
}
/*添加人员缓存人员默认按id显示顺序,HrmResource_Trigger_Insert 人员共享 入职维护项目状态*/
@ -824,7 +823,7 @@ public class HrmImportProcessE9 extends BaseBean {
new HrmDateCheck().calWorkInfo("" + id);
// 刷新组织结构图
new Thread(new HrmResourceTriggerRunnable((long) id)).start();
// new HrmResourceTriggerRunnable((long) id).run();
}
@ -1394,8 +1393,7 @@ public class HrmImportProcessE9 extends BaseBean {
if (updateWorkData(vo.getWorkFields().trim(), vo.getWorkFieldsValue(), keyMap.get(key)))
flag = false;
//TODO 更新聚才林相关字段
//CusFieldDataTrigger.run((long) keyMap.get(key));
CusFieldDataTrigger.run((long) keyMap.get(key));
/*update HrmResource_Trigger */
if (flag) {
@ -1499,7 +1497,7 @@ public class HrmImportProcessE9 extends BaseBean {
resultList.add(createLog(vo, "更新", "失败", "系统错误,请联系管理员"));
}
// 刷新组织结构图
new Thread(new HrmResourceTriggerRunnable((long) keyMap.get(key))).start();
// new HrmResourceTriggerRunnable((long) keyMap.get(key)).run();
}
} catch (Exception e) {
//数据异常

@ -35,7 +35,7 @@ public class SearchTreeUtil {
// 排序,设置是否为叶子节点
List<TreeNode> collect = treeList.stream().peek(item ->
item.setIsParent(CollectionUtils.isNotEmpty(item.getSubs()))
).sorted(Comparator.comparing(item -> Integer.parseInt(item.getId()))).collect(Collectors.toList());
).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(collect)) {
treeDatas.addAll(collect);
}
@ -87,14 +87,16 @@ public class SearchTreeUtil {
* @return
*/
public static List<SearchTree> builderTreeMode(List<SearchTree> treeList) {
List<SearchTree> sortedList = treeList.stream().sorted(Comparator.comparing(SearchTree::getOrderNum)).collect(Collectors.toList());
Map<String, List<TreeNode>> collects = sortedList.stream().collect(Collectors.groupingBy(TreeNode::getPid));
Map<String, List<SearchTree>> collects = treeList.stream().collect(Collectors.groupingBy(TreeNode::getPid));
Set<String> leafIds = new HashSet<>();
List<SearchTree> collect = sortedList.stream().peek(e -> {
e.setSubs(collects.get(e.getId()));
leafIds.add(e.getId());
if (CollectionUtils.isNotEmpty(e.getSubs())) {
e.setIsParent(true);
List<SearchTree> collect = treeList.stream().peek(e -> {
if (null != collects && CollectionUtils.isNotEmpty(collects.get(e.getId()))) {
List<TreeNode> nodes = collects.get(e.getId()).stream().sorted(Comparator.comparing(item -> null == item.getOrderNum() ? 0 : item.getOrderNum())).collect(Collectors.toList());
e.setSubs(nodes);
leafIds.add(e.getId());
if (CollectionUtils.isNotEmpty(e.getSubs())) {
e.setIsParent(true);
}
}
}).collect(Collectors.toList());
return collect.stream().filter(item -> !leafIds.contains(item.getPid())).collect(Collectors.toList());
@ -113,17 +115,15 @@ public class SearchTreeUtil {
boolean isAdd = !childMap.isEmpty();
Set<String> leafIds = new HashSet<>();
List<SearchTree> collect = treeList.stream().peek(e -> {
Set<TreeNode> treeNodes = new HashSet<>();
Set<TreeNode> treeNodes = new LinkedHashSet<>();
if (isAdd && CollectionUtils.isNotEmpty(childMap.get(e.getId()))) {
List<SearchTree> searchTrees = childMap.get(e.getId()).stream().sorted(Comparator.comparing(SearchTree::getOrderNum)).collect(Collectors.toList());
treeNodes.addAll(searchTrees);
}
List<TreeNode> nodes = parentMap.get(e.getId());
if (CollectionUtils.isNotEmpty(nodes)) {
treeNodes.addAll(nodes);
}
if (isAdd && CollectionUtils.isNotEmpty(childMap.get(e.getId()))) {
treeNodes.addAll(childMap.get(e.getId()));
}
if (CollectionUtils.isNotEmpty(e.getSubs())) {
treeNodes.addAll(e.getSubs());
}
e.setSubs(new ArrayList<>(treeNodes));
leafIds.add(e.getId());
}).collect(Collectors.toList());
@ -153,4 +153,8 @@ public class SearchTreeUtil {
public static boolean isTop(Long pid) {
return null == pid;
}
public static boolean isTop(Integer pid) {
return null == pid;
}
}

@ -35,7 +35,28 @@ import java.util.stream.Collectors;
public class ExportCommonController {
private ExportCommonWrapper getExportCommonWrapper(User user) {
return ServiceUtil.getService(ExportCommonWrapper.class,user);
return ServiceUtil.getService(ExportCommonWrapper.class, user);
}
@GET
@Path("/staff/export")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response staffExport(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
XSSFWorkbook workbook = getExportCommonWrapper(user).staffExport();
String time = LocalDate.now().toString();
String fileName = "编制信息" + time;
try {
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
StreamingOutput output = outputStream -> {
workbook.write(outputStream);
outputStream.flush();
};
response.setContentType("application/octet-stream");
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
}
@GET

@ -1,228 +0,0 @@
package com.engine.organization.web;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.organization.entity.hrmresource.param.HrmRelationSaveParam;
import com.engine.organization.entity.hrmresource.param.HrmResourceSearchParam;
import com.engine.organization.entity.searchtree.SearchTreeParams;
import com.engine.organization.util.response.ReturnResult;
import com.engine.organization.wrapper.HrmResourceWrapper;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2022/06/21
* @version: 1.0
*/
public class HrmResourceController {
public HrmResourceWrapper getHrmResourceWrapper(User user) {
return ServiceUtil.getService(HrmResourceWrapper.class, user);
}
/**
*
*
* @param request
* @param response
* @return
*/
@GET
@Path("/getSearchTree")
@Produces(MediaType.APPLICATION_JSON)
public Map<String, Object> getSearchTree(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request);
SearchTreeParams params = JSONObject.toJavaObject((JSON) JSONObject.toJSON(map), SearchTreeParams.class);
return getHrmResourceWrapper(user).getSearchTree(params);
}
/**
* list
*
* @param request
* @param response
* @return
*/
@GET
@Path("/listPage")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult listPage(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request);
HrmResourceSearchParam param = JSONObject.toJavaObject((JSON) JSONObject.toJSON(map), HrmResourceSearchParam.class);
return ReturnResult.successed(getHrmResourceWrapper(user).listPage(param));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
/**
*
*
* @param request
* @param response
* @return
*/
@GET
@Path("/getSaveForm")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult getSaveForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getHrmResourceWrapper(user).getSaveForm());
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
/**
*
*
* @param request
* @param response
* @return
*/
@POST
@Path("/saveBaseForm")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult saveBaseForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Map<String, Object> params) {
try {
User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getHrmResourceWrapper(user).saveBaseForm(params));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
/**
*
*
* @param request
* @param response
* @return
*/
@GET
@Path("/getBaseForm")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult getBaseForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request);
return ReturnResult.successed(getHrmResourceWrapper(user).getBaseForm(map));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
/**
*
*
* @param request
* @param response
* @return
*/
@POST
@Path("/updateForm")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult updateForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request);
return ReturnResult.successed(getHrmResourceWrapper(user).updateForm(map));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
/**
*
*
* @param request
* @param response
* @return
*/
@GET
@Path("/getSearchCondition")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult getSearchCondition(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request);
return ReturnResult.successed(getHrmResourceWrapper(user).getSearchCondition(map));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
/**
*
*
* @param request
* @param response
* @return
*/
@GET
@Path("/getHasRight")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult getHasRight(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getHrmResourceWrapper(user).getHasRight());
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
@GET
@Path("/getTabForm")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult getTabForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request);
return ReturnResult.successed(getHrmResourceWrapper(user).getTabForm(map));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
@POST
@Path("/saveTabForm")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult saveTabForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody HrmRelationSaveParam params) {
try {
User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getHrmResourceWrapper(user).saveTabForm(params));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
@POST
@Path("/updateTabForm")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult updateTabForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody HrmRelationSaveParam params) {
try {
User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getHrmResourceWrapper(user).updateTabForm(params));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
}

@ -1,134 +0,0 @@
package com.engine.organization.web;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.organization.entity.DeleteParam;
import com.engine.organization.entity.detach.param.ManagerDetachParam;
import com.engine.organization.util.response.ReturnResult;
import com.engine.organization.wrapper.ManagerDetachWrapper;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.Map;
/**
* @Author weaver_cl
* @Description:
* @Date 2022/10/21
* @Version V1.0
**/
public class ManagerDetachController {
public ManagerDetachWrapper getManagerDetachWrapper(User user) {
return ServiceUtil.getService(ManagerDetachWrapper.class,user);
}
@GET
@Path("/getTable")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult listPage(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request);
return ReturnResult.successed(getManagerDetachWrapper(user).listPage(map));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
@GET
@Path("/getTableBtn")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult getTableBtn(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getManagerDetachWrapper(user).getTableBtn());
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
@GET
@Path("/getSearchCondition")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult getSearchCondition(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getManagerDetachWrapper(user).getSearchCondition());
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
@GET
@Path("/getForm")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult getForm(@Context HttpServletRequest request, @Context HttpServletResponse response,
@QueryParam("id") Integer id) {
try {
User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getManagerDetachWrapper(user).getForm(id));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
@POST
@Path("/deleteByIds")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult deleteByIds(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody DeleteParam param) {
try {
User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getManagerDetachWrapper(user).deleteByIds(param.getIds()));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
@POST
@Path("/save")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult saveDetach(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody ManagerDetachParam param) {
try {
User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getManagerDetachWrapper(user).save(param));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
@POST
@Path("/update")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult updateDetach(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody ManagerDetachParam param) {
try {
User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getManagerDetachWrapper(user).updateDetach(param));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
@GET
@Path("/doDetach")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult doDetach(@Context HttpServletRequest request,@Context HttpServletResponse response,
@QueryParam("idDetach") String isDetach) {
try {
User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getManagerDetachWrapper(user).doDetach(isDetach));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
}

@ -1,56 +0,0 @@
package com.engine.organization.web;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.organization.util.response.ReturnResult;
import com.engine.organization.wrapper.PersonnelCardWrapper;
import org.apache.commons.lang3.StringUtils;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2022/10/09
* @version: 1.0
*/
public class PersonnelCardController {
public PersonnelCardWrapper getPersonnelCardWrapper(User user) {
return ServiceUtil.getService(PersonnelCardWrapper.class, user);
}
@GET
@Path("/getPersonnelCard")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult getPersonnelCard(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request);
String id = Util.null2String(map.get("id"));
return ReturnResult.successed(getPersonnelCardWrapper(user).getPersonnelCard(StringUtils.isBlank(id) ? null : Long.parseLong(id)));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
@GET
@Path("/getIframeList")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult getIframeList(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getPersonnelCardWrapper(user).getIframeList());
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
}

@ -18,10 +18,14 @@ import java.util.List;
public class ExportCommonWrapper extends Service {
public ExportCommonService getExportCommonService(User user) {
return ServiceUtil.getService(ExportCommonServiceImpl.class,user);
return ServiceUtil.getService(ExportCommonServiceImpl.class, user);
}
public XSSFWorkbook resourceExport(List<Long> ids) {
return getExportCommonService(user).resourceExport(ids);
}
public XSSFWorkbook staffExport() {
return getExportCommonService(user).staffExport();
}
}

@ -1,78 +0,0 @@
package com.engine.organization.wrapper;
import com.alibaba.fastjson.JSON;
import com.engine.common.util.ServiceUtil;
import com.engine.organization.annotation.Log;
import com.engine.organization.entity.hrmresource.param.HrmRelationSaveParam;
import com.engine.organization.entity.hrmresource.param.HrmResourceSearchParam;
import com.engine.organization.entity.searchtree.SearchTreeParams;
import com.engine.organization.enums.LogModuleNameEnum;
import com.engine.organization.enums.OperateTypeEnum;
import com.engine.organization.service.HrmResourceService;
import com.engine.organization.service.impl.HrmResourceServiceImpl;
import com.engine.organization.util.OrganizationWrapper;
import weaver.hrm.User;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2022/06/21
* @version: 1.0
*/
public class HrmResourceWrapper extends OrganizationWrapper {
private HrmResourceService getHrmResourceService(User user) {
return ServiceUtil.getService(HrmResourceServiceImpl.class, user);
}
public Map<String, Object> getSearchTree(SearchTreeParams params) {
return getHrmResourceService(user).getSearchTree(params);
}
public Map<String, Object> listPage(HrmResourceSearchParam params) {
return getHrmResourceService(user).listPage(params);
}
public Map<String, Object> getSaveForm() {
return getHrmResourceService(user).getSaveForm();
}
@Log(operateType = OperateTypeEnum.ADD, operateModule = LogModuleNameEnum.RESOURCE, operateDesc = "新增人员")
public Long saveBaseForm(Map<String, Object> params) {
Long resourceId = getHrmResourceService(user).saveBaseForm(params);
writeOperateLog(new Object() {
}.getClass(), params.get("last_name").toString(), JSON.toJSONString(params), "新增人员");
return resourceId;
}
public Map<String, Object> getBaseForm(Map<String, Object> params) {
return getHrmResourceService(user).getBaseForm(params);
}
public int updateForm(Map<String, Object> params) {
int updateForm = getHrmResourceService(user).updateForm(params);
return updateForm;
}
public Map<String, Object> getSearchCondition(Map<String, Object> params) {
return getHrmResourceService(user).getSearchCondition(params);
}
public Map<String, Object> getHasRight() {
return getHrmResourceService(user).getHasRight();
}
public Map<String, Object> getTabForm(Map<String, Object> params) {
return getHrmResourceService(user).getTabForm(params);
}
public long saveTabForm(HrmRelationSaveParam params) {
return getHrmResourceService(user).saveTabForm(params);
}
public long updateTabForm(HrmRelationSaveParam params) {
return getHrmResourceService(user).updateTabForm(params);
}
}

@ -2,6 +2,7 @@ package com.engine.organization.wrapper;
import com.engine.organization.entity.company.po.CompPO;
import com.engine.organization.entity.department.po.DepartmentPO;
import com.engine.organization.trigger.cusfielddata.CusFieldDataTrigger;
import com.engine.organization.util.OrganizationWrapper;
import com.engine.organization.util.relation.EcHrmRelationUtil;
import org.apache.commons.lang3.StringUtils;
@ -54,6 +55,6 @@ public class JclOrgWrapper extends OrganizationWrapper {
}
public void syncCusFieldData(String id) {
// CusFieldDataTrigger.run(StringUtils.isNotBlank(id) ? Long.parseLong(id) : null);
CusFieldDataTrigger.run(StringUtils.isNotBlank(id) ? Long.parseLong(id) : null);
}
}

@ -1,93 +0,0 @@
package com.engine.organization.wrapper;
import com.alibaba.fastjson.JSON;
import com.api.browser.bean.SearchConditionGroup;
import com.api.browser.bean.SearchConditionItem;
import com.engine.common.util.ServiceUtil;
import com.engine.organization.annotation.Log;
import com.engine.organization.entity.detach.param.ManagerDetachParam;
import com.engine.organization.entity.detach.po.ManagerDetachPO;
import com.engine.organization.enums.LogModuleNameEnum;
import com.engine.organization.enums.OperateTypeEnum;
import com.engine.organization.mapper.detach.ManagerDetachMapper;
import com.engine.organization.service.ManagerDetachService;
import com.engine.organization.service.impl.ManagerDetachServiceImpl;
import com.engine.organization.util.MenuBtn;
import com.engine.organization.util.OrganizationFormItemUtil;
import com.engine.organization.util.OrganizationWrapper;
import com.engine.organization.util.db.MapperProxyFactory;
import weaver.hrm.User;
import java.util.*;
/**
* @Author weaver_cl
* @Description:
* @Date 2022/10/21
* @Version V1.0
**/
public class ManagerDetachWrapper extends OrganizationWrapper {
public ManagerDetachService getManagerDetachService(User user) {
return ServiceUtil.getService(ManagerDetachServiceImpl.class,user);
}
public Map<String, Object> listPage(Map<String, Object> params) {
return getManagerDetachService(user).listPage(params);
}
public Map<String, List<MenuBtn>> getTableBtn() {
return MenuBtn.getCommonBtnDatas();
}
public Map<String, Object> getSearchCondition() {
Map<String, Object> apiDatas = new HashMap<>();
List<SearchConditionGroup> addGroups = new ArrayList<>();
List<SearchConditionItem> conditionItems = new ArrayList<>();
SearchConditionItem ecManager = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "管理员名称", "ecManager");
SearchConditionItem ecRolelevel = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "可管理组织机构", "164", "ecRolelevel", "");
conditionItems.add(ecManager);
conditionItems.add(ecRolelevel);
addGroups.add(new SearchConditionGroup("高级搜索条件", true, conditionItems));
apiDatas.put("conditions", addGroups);
return apiDatas;
}
public Map<String, Object> getForm(Integer id) {
return getManagerDetachService(user).getForm(id);
}
@Log(operateType = OperateTypeEnum.DELETE,operateModule = LogModuleNameEnum.DETACH,operateDesc = "删除分权数据")
public int deleteByIds(Collection<Long> ids) {
List<ManagerDetachPO> managerDetachPOS = MapperProxyFactory.getProxy(ManagerDetachMapper.class).selectByIds(ids);
int deleteByIds = getManagerDetachService(user).deleteByIds(ids);
for (ManagerDetachPO managerDetachPO : managerDetachPOS) {
writeOperateLog(new Object() {
}.getClass(), String.valueOf(managerDetachPO.getEcManager()), JSON.toJSONString(ids), "删除等级方案");
}
return deleteByIds;
}
@Log(operateType = OperateTypeEnum.ADD,operateModule = LogModuleNameEnum.DETACH,operateDesc = "新增分权管理员")
public int save(ManagerDetachParam param) {
int save = getManagerDetachService(user).save(param);
writeOperateLog(new Object() {
}.getClass(), String.valueOf(param.getEcManager()), JSON.toJSONString(param), "新增分权管理员");
return save;
}
@Log(operateType = OperateTypeEnum.UPDATE, operateModule = LogModuleNameEnum.DETACH, operateDesc = "分权数据更新")
public int updateDetach(ManagerDetachParam param) {
ManagerDetachPO managerDetachPO = MapperProxyFactory.getProxy(ManagerDetachMapper.class).getDetachById(param.getId());
int result = getManagerDetachService(user).updateDetach(param);
writeOperateLog(new Object() {
}.getClass(), String.valueOf(managerDetachPO.getEcManager()), JSON.toJSONString(param), managerDetachPO, MapperProxyFactory.getProxy(ManagerDetachMapper.class).getDetachById(param.getId()));
return result;
}
public String doDetach(String isDetach) {
return getManagerDetachService(user).doDetach(isDetach);
}
}

@ -3,7 +3,7 @@ package com.engine.organization.wrapper;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.organization.service.OrgChartService;
import com.engine.organization.service.impl.OrgChartServiceImpl;
import com.engine.organization.service.impl.JyChartServiceImpl;
import weaver.hrm.User;
import java.util.Map;
@ -16,7 +16,7 @@ import java.util.Map;
**/
public class OrgChartWrapper extends Service {
private OrgChartService getOrgChartService(User user) {
return ServiceUtil.getService(OrgChartServiceImpl.class, user);
return ServiceUtil.getService(JyChartServiceImpl.class, user);
}

@ -1,31 +0,0 @@
package com.engine.organization.wrapper;
import com.engine.common.util.ServiceUtil;
import com.engine.organization.entity.personnelcard.Iframe;
import com.engine.organization.service.HrmPersonnelCardService;
import com.engine.organization.service.impl.HrmPersonnelCardServiceImpl;
import com.engine.organization.util.OrganizationWrapper;
import weaver.hrm.User;
import java.util.List;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2022/10/08
* @version: 1.0
*/
public class PersonnelCardWrapper extends OrganizationWrapper {
private HrmPersonnelCardService getHrmPersonnelCardService(User user) {
return ServiceUtil.getService(HrmPersonnelCardServiceImpl.class, user);
}
public Map<String, Object> getPersonnelCard(Long uId) {
return getHrmPersonnelCardService(user).getPersonnelCard(uId);
}
public List<Iframe> getIframeList() {
return getHrmPersonnelCardService(user).getIframeList();
}
}
Loading…
Cancel
Save