组织架构图编制、在岗,数据优化

pull/5/head
dxfeng 3 years ago
parent f16391fc9b
commit c6fb0d129b

@ -0,0 +1,68 @@
-- 更新表结构
alter table JCL_ORG_COMP add ec_company int;
alter table JCL_ORG_DEPT add ec_company int;
alter table JCL_ORG_DEPT add ec_department int;
alter table jcl_org_staffplan add ec_company varchar(100);
alter table jcl_org_staff add ec_company int;
alter table jcl_org_staff add ec_department int;
alter table JCL_ORG_STAFFS add description varchar(200);
-- 插入自定义信息
insert INTO jcl_field_extendinfo (extend_type, table_name, field_name, field_name_desc, field_type, control_type, extend_group_id, isenable, isrequired, list_show, search_show, edit_show, add_show, browser_show, show_order, creator, delete_type, create_time, update_time, browser_type, custom_value, is_system_default) VALUES (1, 'JCL_ORG_COMP', 'ec_company', '上级公司', 'int', 3, 1, 1, 0, 1, 1, 1, 1, 1, 6, 1, 0, now(), NULL, '164', '["browser",{"valueSpan":"分部","replaceDatas":[{"name":"分部","id":"164"}],"value":"164"}]', 0);
insert INTO jcl_field_extendinfo (extend_type, table_name, field_name, field_name_desc, field_type, control_type, extend_group_id, isenable, isrequired, list_show, search_show, edit_show, add_show, browser_show, show_order, creator, delete_type, create_time, update_time, browser_type, custom_value, is_system_default) VALUES (2, 'JCL_ORG_DEPT', 'ec_company', '所属分部', 'int', 3, 2, 1, 1, 1, 1, 1, 1, 1, 4, 1, 0, now(), NULL, '164', '["browser",{"valueSpan":"分部","replaceDatas":[{"name":"分部","id":"164"}],"value":"164"}]', 0);
insert INTO jcl_field_extendinfo (extend_type, table_name, field_name, field_name_desc, field_type, control_type, extend_group_id, isenable, isrequired, list_show, search_show, edit_show, add_show, browser_show, show_order, creator, delete_type, create_time, update_time, browser_type, custom_value, is_system_default) VALUES (2, 'JCL_ORG_DEPT', 'ec_department', '上级部门', 'int', 3, 2, 1, 0, 1, 1, 1, 1, 1, 5, 1, 0, now(), NULL, '4', '["browser",{"valueSpan":"部门","replaceDatas":[{"name":"部门","id":"4"}],"value":"4"}]', 0);
-- 更新自定义字段信息
update jcl_field_extendinfo set list_show =0,search_show =0,edit_show =0,add_show =0 where table_name ='JCL_ORG_COMP' and field_name ='parent_company';
update jcl_field_extendinfo set list_show =0,search_show =0,edit_show =0,add_show =0 where table_name ='JCL_ORG_DEPT' and field_name ='parent_comp';
update jcl_field_extendinfo set list_show =0,search_show =0,edit_show =0,add_show =0 where table_name ='JCL_ORG_DEPT' and field_name ='parent_dept';
update jcl_field_extendinfo set search_show=0,edit_show=0,add_show=0 where table_name ='JCL_ORG_JOB' and field_name='ec_company';
-- 更新浏览按钮
update WORKFLOW_BROWSERURL set TYPEID ='2' where ID = '666';
update datashowparam set ISSHOWNAME =0 where SEARCHNAME = 'post_info_no';
update datashowparam set ISSHOWNAME =1 where SEARCHNAME = 'post_info_name';
-- 更新视图
drop view v_jcl_zdzj;
drop view v_jcl_post;
create view v_jcl_zdzj as
select concat('A',xl.id) fid,xl.sequence_name fname,'0' fparentid,xl.sequence_no fno,xl.id fobjid,'1' as ftype
from jcl_org_sequence xl
inner join JCL_ORG_GRADE zj on zj.scheme_id=xl.scheme_id and ifnull(zj.forbidden_tag,0)<>1 and ifnull(zj.delete_type,0)<>1
inner join JCL_ORG_LEVEL zd on zd.scheme_id=zd.scheme_id and ifnull(zd.forbidden_tag,0)<>1 and ifnull(zd.delete_type,0)<>1
where ifnull(xl.forbidden_tag,0)<>1 and ifnull(xl.delete_type,0)<>1
union
select concat(xl.id,'A',zj.id),zj.grade_name,concat('A',xl.id),zj.grade_no,zj.id,'2' as ftype
from JCL_ORG_GRADE zj
inner join jcl_org_sequence xl on zj.scheme_id=xl.scheme_id
inner join JCL_ORG_LEVEL zd on concat(',',zj.level_id,',') like concat('%,',zd.id,',%') and ifnull(zd.forbidden_tag,0)<>1 and ifnull(zd.delete_type,0)<>1
where ifnull(zj.forbidden_tag,0)<>1 and ifnull(zj.delete_type,0)<>1
union
select concat(xl.id,'A',zj.id,'A',zd.id),zd.level_name,concat(xl.id,'A',zj.id),zd.level_no,zd.id,'3' as ftype
from JCL_ORG_LEVEL zd
inner join JCL_ORG_GRADE zj on concat(',',zj.level_id,',') like concat('%,',zd.id,',%')
inner join jcl_org_sequence xl on zj.scheme_id=xl.scheme_id
where ifnull(zd.forbidden_tag,0)<>1 and ifnull(zd.delete_type,0)<>1;
create view v_jcl_post as
select a.id*-1 fid,a.post_name fname,0 fparentid from JCL_ORG_POST a
inner join JCL_ORG_POST_INFO b on a.id =b.post_id and ifnull(b.forbidden_tag,0)<>1 and ifnull(b.delete_type,0)<>1
where ifnull(a.delete_type,0)<>1
union
select id,post_info_name,post_id*-1 from JCL_ORG_POST_INFO
where ifnull(forbidden_tag,0)<>1 and ifnull(delete_type,0)<>1;
--- MySQL
-- 更新分部ec_company
update jcl_org_comp d set ec_company = ( select eccompany from ( select b.id as parent_company, c.id as eccompany from jcl_org_comp a inner join jcl_org_comp b on a.parent_company = b.id inner join hrmsubcompany c on b.uuid = c.uuid group by b.id ) e where d.parent_company = e.parent_company );
-- 更新部门ec_department、ec_company
update JCL_ORG_DEPT d set ec_department = ( select ecdepartment from ( select b.id as parent_dept, c.id as ecdepartment from JCL_ORG_DEPT a inner join JCL_ORG_DEPT b on a.parent_dept = b.id inner join hrmdepartment c on b.uuid = c.uuid group by b.id ) e where d.parent_dept = e.parent_dept );
update JCL_ORG_DEPT d set ec_company = ( select eccompany from ( select a.id as id, c.id as eccompany from jcl_org_comp a inner join hrmsubcompany c on a.uuid = c.uuid) e where d.parent_comp = e.id );
-- 更新人员jobtitle
update hrmresource set jobtitle = ( select id from HRMJOBTITLES where JOBTITLENAME = ( select JOB_NAME from jcl_org_job where id = ( select FIELD100002 from CUS_FIELDDATA where scope = 'HrmCustomFieldByInfoType' and SCOPEID = '-1' and CUS_FIELDDATA.ID = hrmresource.ID)));
-- 更新岗位ec_company、ec_department
update jcl_org_job d set ec_company = (select eccompany from ( select a.id as id, c.id as eccompany from jcl_org_comp a inner join hrmsubcompany c on a.uuid = c.uuid) e where d.parent_comp = e.id );
update jcl_org_job d set ec_department = ( select ec_department from ( select a.id as id, c.id as ec_department from jcl_org_dept a inner join hrmdepartment c on a.uuid = c.uuid) e where d.parent_dept = e.id );

@ -0,0 +1,67 @@
-- 更新表结构
alter table JCL_ORG_COMP add ec_company int;
alter table JCL_ORG_DEPT add ec_company int;
alter table JCL_ORG_DEPT add ec_department int;
alter table jcl_org_staffplan add ec_company varchar(100);
alter table jcl_org_staff add ec_company int;
alter table jcl_org_staff add ec_department int;
alter table JCL_ORG_STAFFS add description varchar(200);
-- 插入自定义信息
insert INTO jcl_field_extendinfo (extend_type, table_name, field_name, field_name_desc, field_type, control_type, extend_group_id, isenable, isrequired, list_show, search_show, edit_show, add_show, browser_show, show_order, creator, delete_type, create_time, update_time, browser_type, custom_value, is_system_default) VALUES (1, 'JCL_ORG_COMP', 'ec_company', '上级公司', 'int', 3, 1, 1, 0, 1, 1, 1, 1, 1, 6, 1, 0, SYSDATE, NULL, '164', '["browser",{"valueSpan":"分部","replaceDatas":[{"name":"分部","id":"164"}],"value":"164"}]', 0);
insert INTO jcl_field_extendinfo (extend_type, table_name, field_name, field_name_desc, field_type, control_type, extend_group_id, isenable, isrequired, list_show, search_show, edit_show, add_show, browser_show, show_order, creator, delete_type, create_time, update_time, browser_type, custom_value, is_system_default) VALUES (2, 'JCL_ORG_DEPT', 'ec_company', '所属分部', 'int', 3, 2, 1, 1, 1, 1, 1, 1, 1, 4, 1, 0, SYSDATE, NULL, '164', '["browser",{"valueSpan":"分部","replaceDatas":[{"name":"分部","id":"164"}],"value":"164"}]', 0);
insert INTO jcl_field_extendinfo (extend_type, table_name, field_name, field_name_desc, field_type, control_type, extend_group_id, isenable, isrequired, list_show, search_show, edit_show, add_show, browser_show, show_order, creator, delete_type, create_time, update_time, browser_type, custom_value, is_system_default) VALUES (2, 'JCL_ORG_DEPT', 'ec_department', '上级部门', 'int', 3, 2, 1, 0, 1, 1, 1, 1, 1, 5, 1, 0, SYSDATE, NULL, '4', '["browser",{"valueSpan":"部门","replaceDatas":[{"name":"部门","id":"4"}],"value":"4"}]', 0);
-- 更新自定义字段信息
update jcl_field_extendinfo set list_show =0,search_show =0,edit_show =0,add_show =0 where table_name ='JCL_ORG_COMP' and field_name ='parent_company';
update jcl_field_extendinfo set list_show =0,search_show =0,edit_show =0,add_show =0 where table_name ='JCL_ORG_DEPT' and field_name ='parent_comp';
update jcl_field_extendinfo set list_show =0,search_show =0,edit_show =0,add_show =0 where table_name ='JCL_ORG_DEPT' and field_name ='parent_dept';
update jcl_field_extendinfo set search_show=0,edit_show=0,add_show=0 where table_name ='JCL_ORG_JOB' and field_name='ec_company';
-- 更新浏览按钮
update WORKFLOW_BROWSERURL set TYPEID ='2' where ID = '666';
update datashowparam set ISSHOWNAME =0 where SEARCHNAME = 'post_info_no';
update datashowparam set ISSHOWNAME =1 where SEARCHNAME = 'post_info_name';
-- 更新视图
drop view v_jcl_zdzj;
drop view v_jcl_post;
create or replace view v_jcl_zdzj as
select 'A'||xl.id fid,xl.sequence_name fname,'0' fparentid,xl.sequence_no fno,xl.id fobjid,'1' as ftype
from jcl_org_sequence xl
INNER JOIN JCL_ORG_GRADE zj ON zj.scheme_id=xl.scheme_id AND nvl(zj.forbidden_tag,0)<>1 and nvl(zj.delete_type,0)<>1
INNER JOIN JCL_ORG_LEVEL zd ON zd.scheme_id=xl.scheme_id AND nvl(zd.forbidden_tag,0)<>1 and nvl(zd.delete_type,0)<>1
where nvl(xl.forbidden_tag,0)<>1 and nvl(xl.delete_type,0)<>1
union
select xl.id ||'A'|| zj.id ,zj.grade_name,'A'|| xl.id ,zj.grade_no,zj.id,'2' as ftype
from JCL_ORG_GRADE zj
inner join jcl_org_sequence xl on zj.scheme_id=xl.scheme_id
INNER JOIN JCL_ORG_LEVEL zd on ','|| zj.level_id ||',' like '%,'|| zd.id ||',%' AND nvl(zd.forbidden_tag,0)<>1 and nvl(zd.delete_type,0)<>1
where nvl(zj.forbidden_tag,0)<>1 and nvl(zj.delete_type,0)<>1
union
select xl.id ||'A'|| zj.id ||'A'|| zd.id ,zd.level_name, xl.id ||'A'|| zj.id ,zd.level_no,zd.id,'3' as ftype
from JCL_ORG_LEVEL zd
inner join JCL_ORG_GRADE zj on ','|| zj.level_id ||',' like '%,'|| zd.id ||',%'
inner join jcl_org_sequence xl on zj.scheme_id=xl.scheme_id
where nvl(zd.forbidden_tag,0)<>1 and nvl(zd.delete_type,0)<>1;
create or replace view v_jcl_post as
select a.id*-1 fid,a.post_name fname,0 fparentid from JCL_ORG_POST a
inner join JCL_ORG_POST_INFO b on a.id =b.post_id and nvl(b.forbidden_tag,0)<>1 and nvl(b.delete_type,0)<>1
where nvl(a.delete_type,0)<>1
union
select id,post_info_name,post_id*-1 from JCL_ORG_POST_INFO
where nvl(forbidden_tag,0)<>1 and nvl(delete_type,0)<>1;
-- SqlServer
-- 更新分部ec_company
update jcl_org_comp set ec_company = ( select eccompany from ( select DISTINCT b.id as parent_company, c.id as eccompany from jcl_org_comp a inner join jcl_org_comp b on a.parent_company = b.id inner join hrmsubcompany c on b.uuid = c.uuid ) e where jcl_org_comp.parent_company = e.parent_company );
-- 更新部门ec_department、ec_company
update JCL_ORG_DEPT set ec_department = ( select ecdepartment from ( select DISTINCT b.id as parent_dept, c.id as ecdepartment from JCL_ORG_DEPT a inner join JCL_ORG_DEPT b on a.parent_dept = b.id inner join hrmdepartment c on b.uuid = c.uuid ) e where JCL_ORG_DEPT.parent_dept = e.parent_dept );
update JCL_ORG_DEPT set ec_company = ( select eccompany from ( select a.id as id, c.id as eccompany from jcl_org_comp a inner join hrmsubcompany c on a.uuid = c.uuid) e where JCL_ORG_DEPT.parent_comp = e.id );
-- 更新人员jobtitle
update hrmresource set jobtitle = ( select id from HRMJOBTITLES where JOBTITLENAME = ( select JOB_NAME from jcl_org_job where id = ( select FIELD100002 from CUS_FIELDDATA where scope = 'HrmCustomFieldByInfoType' and SCOPEID = '-1' and CUS_FIELDDATA.ID = hrmresource.ID)));
-- 更新岗位ec_company、ec_department
update jcl_org_job set ec_company = (select eccompany from ( select a.id as id, c.id as eccompany from jcl_org_comp a inner join hrmsubcompany c on a.uuid = c.uuid) e where jcl_org_job.parent_comp = e.id );
update jcl_org_job set ec_department = ( select ec_department from ( select a.id as id, c.id as ec_department from jcl_org_dept a inner join hrmdepartment c on a.uuid = c.uuid) e where jcl_org_job.parent_dept = e.id );

@ -0,0 +1,66 @@
-- 更新表结构
alter table JCL_ORG_COMP add ec_company int;
alter table JCL_ORG_DEPT add ec_company int;
alter table JCL_ORG_DEPT add ec_department int;
alter table jcl_org_staffplan add ec_company varchar(100);
alter table jcl_org_staff add ec_company int;
alter table jcl_org_staff add ec_department int;
alter table JCL_ORG_STAFFS add description varchar(200);
-- 插入自定义信息
insert INTO jcl_field_extendinfo (extend_type, table_name, field_name, field_name_desc, field_type, control_type, extend_group_id, isenable, isrequired, list_show, search_show, edit_show, add_show, browser_show, show_order, creator, delete_type, create_time, update_time, browser_type, custom_value, is_system_default) VALUES (1, 'JCL_ORG_COMP', 'ec_company', '上级公司', 'int', 3, 1, 1, 0, 1, 1, 1, 1, 1, 6, 1, 0, GETDATE(), NULL, '164', '["browser",{"valueSpan":"分部","replaceDatas":[{"name":"分部","id":"164"}],"value":"164"}]', 0);
insert INTO jcl_field_extendinfo (extend_type, table_name, field_name, field_name_desc, field_type, control_type, extend_group_id, isenable, isrequired, list_show, search_show, edit_show, add_show, browser_show, show_order, creator, delete_type, create_time, update_time, browser_type, custom_value, is_system_default) VALUES (2, 'JCL_ORG_DEPT', 'ec_company', '所属分部', 'int', 3, 2, 1, 1, 1, 1, 1, 1, 1, 4, 1, 0, GETDATE(), NULL, '164', '["browser",{"valueSpan":"分部","replaceDatas":[{"name":"分部","id":"164"}],"value":"164"}]', 0);
insert INTO jcl_field_extendinfo (extend_type, table_name, field_name, field_name_desc, field_type, control_type, extend_group_id, isenable, isrequired, list_show, search_show, edit_show, add_show, browser_show, show_order, creator, delete_type, create_time, update_time, browser_type, custom_value, is_system_default) VALUES (2, 'JCL_ORG_DEPT', 'ec_department', '上级部门', 'int', 3, 2, 1, 0, 1, 1, 1, 1, 1, 5, 1, 0, GETDATE(), NULL, '4', '["browser",{"valueSpan":"部门","replaceDatas":[{"name":"部门","id":"4"}],"value":"4"}]', 0);
-- 更新自定义字段信息
update jcl_field_extendinfo set list_show =0,search_show =0,edit_show =0,add_show =0 where table_name ='JCL_ORG_COMP' and field_name ='parent_company';
update jcl_field_extendinfo set list_show =0,search_show =0,edit_show =0,add_show =0 where table_name ='JCL_ORG_DEPT' and field_name ='parent_comp';
update jcl_field_extendinfo set list_show =0,search_show =0,edit_show =0,add_show =0 where table_name ='JCL_ORG_DEPT' and field_name ='parent_dept';
update jcl_field_extendinfo set search_show=0,edit_show=0,add_show=0 where table_name ='JCL_ORG_JOB' and field_name='ec_company';
-- 更新浏览按钮
update WORKFLOW_BROWSERURL set TYPEID ='2' where ID = '666';
update datashowparam set ISSHOWNAME =0 where SEARCHNAME = 'post_info_no';
update datashowparam set ISSHOWNAME =1 where SEARCHNAME = 'post_info_name';
-- 更新视图
drop view v_jcl_zdzj;
drop view v_jcl_post;
create view v_jcl_zdzj as
select 'A'+cast(xl.id as varchar) fid,xl.sequence_name fname,'0' fparentid,xl.sequence_no fno,xl.id fobjid,'1' as ftype
from jcl_org_sequence xl
inner join JCL_ORG_GRADE zj on zj.scheme_id=xl.scheme_id and isnull(zj.forbidden_tag,0)<>1 and isnull(zj.delete_type,0)<>1
inner join JCL_ORG_LEVEL zd on zd.scheme_id=xl.scheme_id and isnull(zd.forbidden_tag,0)<>1 and isnull(zd.delete_type,0)<>1
where isnull(xl.forbidden_tag,0)<>1 and isnull(xl.delete_type,0)<>1
union
select cast(xl.id as varchar)+'A'+cast(zj.id as varchar),zj.grade_name,'A'+cast(xl.id as varchar),zj.grade_no,zj.id,'2' as ftype
from JCL_ORG_GRADE zj
inner join jcl_org_sequence xl on zj.scheme_id=xl.scheme_id
inner join JCL_ORG_LEVEL zd on ','+cast(zj.level_id as varchar)+',' like '%,'+cast(zd.id as varchar)+',%' and isnull(zd.forbidden_tag,0)<>1 and isnull(zd.delete_type,0)<>1
where isnull(zj.forbidden_tag,0)<>1 and isnull(zj.delete_type,0)<>1
union
select cast(xl.id as varchar)+'A'+cast(zj.id as varchar)+'A'+cast(zd.id as varchar),zd.level_name,cast(xl.id as varchar)+'A'+cast(zj.id as varchar),zd.level_no,zd.id,'3' as ftype
from JCL_ORG_LEVEL zd
inner join JCL_ORG_GRADE zj on ','+cast(zj.level_id as varchar)+',' like '%,'+cast(zd.id as varchar)+',%'
inner join jcl_org_sequence xl on zj.scheme_id=xl.scheme_id
where isnull(zd.forbidden_tag,0)<>1 and isnull(zd.delete_type,0)<>1;
create view v_jcl_post as
select a.id*-1 fid,a.post_name fname,0 fparentid from JCL_ORG_POST a
inner join JCL_ORG_POST_INFO b on a.id =b.post_id and isnull(b.forbidden_tag,0)<>1 and isnull(b.delete_type,0)<>1
where isnull(a.delete_type,0)<>1
union
select id,post_info_name,post_id*-1 from JCL_ORG_POST_INFO
where isnull(forbidden_tag,0)<>1 and isnull(delete_type,0)<>1;
-- SqlServer
-- 更新分部ec_company
update jcl_org_comp set ec_company = ( select eccompany from ( select DISTINCT b.id as parent_company, c.id as eccompany from jcl_org_comp a inner join jcl_org_comp b on a.parent_company = b.id inner join hrmsubcompany c on b.uuid = c.uuid ) e where jcl_org_comp.parent_company = e.parent_company );
-- 更新部门ec_department、ec_company
update JCL_ORG_DEPT set ec_department = ( select ecdepartment from ( select DISTINCT b.id as parent_dept, c.id as ecdepartment from JCL_ORG_DEPT a inner join JCL_ORG_DEPT b on a.parent_dept = b.id inner join hrmdepartment c on b.uuid = c.uuid ) e where JCL_ORG_DEPT.parent_dept = e.parent_dept );
update JCL_ORG_DEPT set ec_company = ( select eccompany from ( select a.id as id, c.id as eccompany from jcl_org_comp a inner join hrmsubcompany c on a.uuid = c.uuid) e where JCL_ORG_DEPT.parent_comp = e.id );
-- 更新人员jobtitle
update hrmresource set jobtitle = ( select id from HRMJOBTITLES where JOBTITLENAME = ( select JOB_NAME from jcl_org_job where id = ( select FIELD100002 from CUS_FIELDDATA where scope = 'HrmCustomFieldByInfoType' and SCOPEID = '-1' and CUS_FIELDDATA.ID = hrmresource.ID)));
-- 更新岗位ec_company、ec_department
update jcl_org_job set ec_company = (select eccompany from ( select a.id as id, c.id as eccompany from jcl_org_comp a inner join hrmsubcompany c on a.uuid = c.uuid) e where jcl_org_job.parent_comp = e.id );
update jcl_org_job set ec_department = ( select ec_department from ( select a.id as id, c.id as ec_department from jcl_org_dept a inner join hrmdepartment c on a.uuid = c.uuid) e where jcl_org_job.parent_dept = e.id );

@ -33,7 +33,7 @@ public class DepartmentListDTO {
/** /**
* *
*/ */
@TableTitle(title = "名称", dataIndex = "deptName", key = "deptName") @TableTitle(title = "名称", dataIndex = "deptName", key = "deptName",width = "200")
private String deptName; private String deptName;
/** /**

@ -1,6 +1,7 @@
package com.engine.organization.mapper.jclorgmap; package com.engine.organization.mapper.jclorgmap;
import com.engine.organization.entity.map.JclOrgMap; import com.engine.organization.entity.map.JclOrgMap;
import org.apache.ibatis.annotations.Param;
/** /**
* @author:dxfeng * @author:dxfeng
@ -9,4 +10,10 @@ import com.engine.organization.entity.map.JclOrgMap;
*/ */
public interface JclOrgMapper { public interface JclOrgMapper {
int insertMap(JclOrgMap jclOrgMap); int insertMap(JclOrgMap jclOrgMap);
JclOrgMap getJclOrgMapByObjID(@Param("currentDate") String currentDate, @Param("fType") String fType, @Param("objId") String objId);
int deleteMap(@Param("ftype") String ftype, @Param("fobjid") String fobjid, @Param("currentDate") String currentDate);
int updateMap(@Param("ftype") String ftype, @Param("fobjid") String fobjid, @Param("currentDate") String currentDate, @Param("yesterday") String yesterday);
} }

@ -13,4 +13,26 @@
#{fObjParentId}, #{fObjParentId},
#{fPlan}, #{fOnJob}, #{fIsVitual}, #{fDateBegin}, #{fDateEnd}) #{fPlan}, #{fOnJob}, #{fIsVitual}, #{fDateBegin}, #{fDateEnd})
</insert> </insert>
<update id="updateMap">
update jcl_org_map
<set>
fdateend=#{currentDate},
</set>
where ftype=#{ftype} and fobjid=#{fobjid} and fdateend &gt; #{currentDate}
</update>
<delete id="deleteMap">
delete
from jcl_org_map
where ftype = #{ftype}
and fobjid = #{fobjid}
and fdatebegin = #{currentDate}
</delete>
<select id="getJclOrgMapByObjID" resultType="com.engine.organization.entity.map.JclOrgMap">
select *
from jcl_org_map
where fobjid = #{objId}
and ftype = #{fType}
AND FDATEBEGIN &lt;= #{currentDate}
AND FDATEEND &gt;= #{currentDate}
</select>
</mapper> </mapper>

@ -3,7 +3,7 @@
<mapper namespace="com.engine.organization.mapper.trigger.GroupTriggerMapper"> <mapper namespace="com.engine.organization.mapper.trigger.GroupTriggerMapper">
<update id="updateMap"> <update id="updateMap">
update jcl_org_map update jcl_org_map
set fdateend=dateadd(day,-1, #{fdate}) set fdateend=#{fdate}
where fobjid = #{fobjid} where fobjid = #{fobjid}
and fdateend &gt; #{fdatebegin} and fdateend &gt; #{fdatebegin}
</update> </update>

@ -8,19 +8,25 @@ import org.apache.ibatis.annotations.Param;
* @version: 1.0 * @version: 1.0
*/ */
public interface StaffTriggerMapper { public interface StaffTriggerMapper {
Integer countCompanyUsers(@Param("ecCompanyId") String ecCompanyId); //Integer countCompanyUsers(@Param("ecCompanyId") String ecCompanyId);
Integer countDepartmentUsers(@Param("ecDepartmentId") String ecDepartmentId); //Integer countDepartmentUsers(@Param("ecDepartmentId") String ecDepartmentId);
Integer countJobUsers(@Param("jobTitle") String jobTitle); Integer countJobUsers(@Param("jobTitle") String jobTitle);
Integer countAllusers(); //Integer countAllUsers();
Integer countCompanyStaffNum(@Param("currentDate") String currentDate, @Param("companyId") Long companyId); Integer countCompanyStaffNum(@Param("currentDate") String currentDate, @Param("companyId") String companyId);
Integer countDepartmentStaffNum(@Param("currentDate") String currentDate, @Param("departmentId") Long departmentId); Integer countDepartmentStaffNum(@Param("currentDate") String currentDate, @Param("departmentId") String departmentId);
Integer countJobStaffNum(@Param("currentDate") String currentDate, @Param("jobId") Long jobId); Integer countJobStaffNum(@Param("currentDate") String currentDate, @Param("jobId") String jobId);
Integer updateOrgStaffs(@Param("currentDate") String currentDate, @Param("fType") String fType, @Param("fObjId") String fObjId, @Param("fPlan") Integer fPlan, @Param("fOnJob") Integer fOnJob); Integer updateOrgStaffs(@Param("currentDate") String currentDate, @Param("fType") String fType, @Param("fObjId") String fObjId, @Param("fPlan") Integer fPlan, @Param("fOnJob") Integer fOnJob);
String getIdByObjIdAndType(@Param("currentDate") String currentDate, @Param("fObjId") String fObjId, @Param("fType") String fType);
Integer sumPlanByParentId(@Param("currentDate") String currentDate, @Param("parentId") String parentId);
Integer sumOnJobByParentId(@Param("currentDate") String currentDate, @Param("parentId") String parentId);
} }

@ -32,7 +32,7 @@
where status &lt;= 3 where status &lt;= 3
and jobtitle = #{jobTitle} and jobtitle = #{jobTitle}
</select> </select>
<select id="countAllusers" resultType="java.lang.Integer"> <select id="countAllUsers" resultType="java.lang.Integer">
select count(1) select count(1)
from hrmresource from hrmresource
where status &lt;= 3 where status &lt;= 3
@ -44,7 +44,8 @@
from JCL_ORG_STAFFPLAN from JCL_ORG_STAFFPLAN
where time_start &lt;= #{currentDate} where time_start &lt;= #{currentDate}
and time_end &gt;= #{currentDate} and time_end &gt;= #{currentDate}
and delete_type = 0) and delete_type = 0
and control_dimension = 1)
and comp_id = #{companyId} and comp_id = #{companyId}
and delete_type = 0 and delete_type = 0
</select> </select>
@ -55,7 +56,8 @@
from JCL_ORG_STAFFPLAN from JCL_ORG_STAFFPLAN
where time_start &lt;= #{currentDate} where time_start &lt;= #{currentDate}
and time_end &gt;= #{currentDate} and time_end &gt;= #{currentDate}
and delete_type = 0) and delete_type = 0
and control_dimension = 2)
and dept_id = #{departmentId} and dept_id = #{departmentId}
and delete_type = 0 and delete_type = 0
</select> </select>
@ -66,8 +68,31 @@
from JCL_ORG_STAFFPLAN from JCL_ORG_STAFFPLAN
where time_start &lt;= #{currentDate} where time_start &lt;= #{currentDate}
and time_end &gt;= #{currentDate} and time_end &gt;= #{currentDate}
and delete_type = 0) and delete_type = 0
and control_dimension = 3)
and job_id = #{jobId} and job_id = #{jobId}
and delete_type = 0 and delete_type = 0
</select> </select>
<select id="getIdByObjIdAndType" resultType="java.lang.String">
select id
from jcl_org_map
where fobjid = #{fObjId}
and ftype = #{fType}
AND FDATEBEGIN &lt;= #{currentDate}
AND FDATEEND &gt;= #{currentDate}
</select>
<select id="sumPlanByParentId" resultType="java.lang.Integer">
select sum(fplan)
from jcl_org_map
where fparentid = #{parentId}
AND FDATEBEGIN &lt;= #{currentDate}
AND FDATEEND &gt;= #{currentDate}
</select>
<select id="sumOnJobByParentId" resultType="java.lang.Integer">
select sum(fonjob)
from jcl_org_map
where fparentid = #{parentId}
AND FDATEBEGIN &lt;= #{currentDate}
AND FDATEEND &gt;= #{currentDate}
</select>
</mapper> </mapper>

@ -532,6 +532,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
deptById.setShowOrder(++maxShowOrder); deptById.setShowOrder(++maxShowOrder);
deptById.setCreator((long) user.getUID()); deptById.setCreator((long) user.getUID());
deptById.setCreateTime(new Date()); deptById.setCreateTime(new Date());
deptById.setDeptPrincipal(null);
// 新增EC表部门 // 新增EC表部门
Map<String, Object> syncMap = addEcDepartment(deptById); Map<String, Object> syncMap = addEcDepartment(deptById);

@ -721,6 +721,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setOperateDetail("未找到对应数据"); historyDetailPO.setOperateDetail("未找到对应数据");
historyDetailPO.setStatus("0"); historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO); saveImportDetailLog(historyDetailPO);
continue;
} }
if (checkRepeatNo(compNo, COMPANY_TYPE, companyId)) { if (checkRepeatNo(compNo, COMPANY_TYPE, companyId)) {
map.put("update_time", new Date()); map.put("update_time", new Date());
@ -874,7 +875,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
map.put("ec_company", EcHrmRelationUtil.getEcCompanyId(parentCompanyId.toString())); map.put("ec_company", EcHrmRelationUtil.getEcCompanyId(parentCompanyId.toString()));
map.put("parent_dept", parentDepartmentId); map.put("parent_dept", parentDepartmentId);
if(null!=parentDepartmentId){ if(null!=parentDepartmentId){
map.put("ec_department", EcHrmRelationUtil.getEcDepartmentId(parentCompanyId.toString())); map.put("ec_department", EcHrmRelationUtil.getEcDepartmentId(parentDepartmentId.toString()));
} }
departmentName = split[split.length - 1]; departmentName = split[split.length - 1];
map.put("dept_name", departmentName); map.put("dept_name", departmentName);
@ -937,6 +938,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setOperateDetail("未找到对应数据"); historyDetailPO.setOperateDetail("未找到对应数据");
historyDetailPO.setStatus("0"); historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO); saveImportDetailLog(historyDetailPO);
continue;
} }
if (checkRepeatNo(deptNo, DEPARTMENT_TYPE, departmentId)) { if (checkRepeatNo(deptNo, DEPARTMENT_TYPE, departmentId)) {
map.put("update_time", new Date()); map.put("update_time", new Date());
@ -1182,6 +1184,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setOperateDetail("未找到对应数据"); historyDetailPO.setOperateDetail("未找到对应数据");
historyDetailPO.setStatus("0"); historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO); saveImportDetailLog(historyDetailPO);
continue;
} }
if (checkRepeatNo(jobNo, JOB_TYPE, jobId)) { if (checkRepeatNo(jobNo, JOB_TYPE, jobId)) {
map.put("update_time", new Date()); map.put("update_time", new Date());
@ -1189,7 +1192,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
map.put("id", jobId); map.put("id", jobId);
Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.JOB, OperateTypeEnum.UPDATE, map, MapperProxyFactory.getProxy(JobMapper.class).getJobById(jobId), false).sync(); Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.JOB, OperateTypeEnum.UPDATE, map, MapperProxyFactory.getProxy(JobMapper.class).getJobById(jobId), false).sync();
if (isThrowError(syncMap)) { if (isThrowError(syncMap)) {
boolean assertNameRepeat = JobServiceImpl.assertNameRepeat(null, Util.null2String(map.get("ec_department")), Util.null2String(map.get("parent_job")), Util.null2String(map.get("job_name"))); boolean assertNameRepeat = JobServiceImpl.assertNameRepeat(jobId.toString(), Util.null2String(map.get("ec_department")), Util.null2String(map.get("parent_job")), Util.null2String(map.get("job_name")));
if (assertNameRepeat) { if (assertNameRepeat) {
map.remove("id"); map.remove("id");
map.remove("jobactivityid"); map.remove("jobactivityid");

@ -234,6 +234,7 @@ public class StaffServiceImpl extends Service implements StaffService {
// 编制数 // 编制数
SearchConditionItem staffNumItem = OrganizationFormItemUtil.inputNumberItem(user, 2, 16, 3, "编制数", "staffNum"); SearchConditionItem staffNumItem = OrganizationFormItemUtil.inputNumberItem(user, 2, 16, 3, "编制数", "staffNum");
staffNumItem.setRules("required"); staffNumItem.setRules("required");
staffNumItem.setMin("0");
// 控制策略 // 控制策略
List<SearchConditionOption> selectOptions = new ArrayList<>(); List<SearchConditionOption> selectOptions = new ArrayList<>();
SearchConditionOption option1 = new SearchConditionOption("1", "弱控"); SearchConditionOption option1 = new SearchConditionOption("1", "弱控");
@ -340,7 +341,7 @@ public class StaffServiceImpl extends Service implements StaffService {
if (null != planId) { if (null != planId) {
sqlWhere += " AND t.plan_id = '" + planId + "'"; sqlWhere += " AND t.plan_id = '" + planId + "'";
} else { } else {
sqlWhere = " 1=2 "; sqlWhere = " where 1 = 2 ";
} }
Long compId = param.getCompId(); Long compId = param.getCompId();
if (null != compId) { if (null != compId) {

@ -4,6 +4,7 @@ import com.engine.organization.entity.company.po.CompPO;
import com.engine.organization.entity.cusfielddata.po.CusFieldData; import com.engine.organization.entity.cusfielddata.po.CusFieldData;
import com.engine.organization.entity.logview.bo.FieldBaseEquator; import com.engine.organization.entity.logview.bo.FieldBaseEquator;
import com.engine.organization.entity.map.JclOrgMap; import com.engine.organization.entity.map.JclOrgMap;
import com.engine.organization.enums.ModuleTypeEnum;
import com.engine.organization.mapper.comp.CompMapper; import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.mapper.jclorgmap.JclOrgMapper; import com.engine.organization.mapper.jclorgmap.JclOrgMapper;
import com.engine.organization.mapper.trigger.CompTriggerMapper; import com.engine.organization.mapper.trigger.CompTriggerMapper;
@ -94,8 +95,14 @@ public class CompanyTriggerRunnable implements Runnable {
jclMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime())); jclMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
jclMap.setFPlan(getCompTriggerMapper().sumStaffNum(jclMap.getFDateBegin(), jclMap.getFObjId())); JclOrgMap jclOrgMapByObjID = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapByObjID(currentDate, ModuleTypeEnum.subcompanyfielddefined.getValue().toString(), jclMap.getFObjId().toString());
jclMap.setFOnJob(getCompTriggerMapper().countHrmResource(jclMap.getFEcId())); if (null != jclOrgMapByObjID) {
jclMap.setFPlan(jclOrgMapByObjID.getFPlan());
jclMap.setFOnJob(jclOrgMapByObjID.getFOnJob());
} else {
jclMap.setFPlan(0);
jclMap.setFOnJob(0);
}
jclMap.setFIsVitual(0); jclMap.setFIsVitual(0);
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();

@ -4,6 +4,7 @@ import com.engine.organization.entity.cusfielddata.po.CusFieldData;
import com.engine.organization.entity.department.po.DepartmentPO; import com.engine.organization.entity.department.po.DepartmentPO;
import com.engine.organization.entity.logview.bo.FieldBaseEquator; import com.engine.organization.entity.logview.bo.FieldBaseEquator;
import com.engine.organization.entity.map.JclOrgMap; import com.engine.organization.entity.map.JclOrgMap;
import com.engine.organization.enums.ModuleTypeEnum;
import com.engine.organization.mapper.department.DepartmentMapper; import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.mapper.jclorgmap.JclOrgMapper; import com.engine.organization.mapper.jclorgmap.JclOrgMapper;
import com.engine.organization.mapper.trigger.CompTriggerMapper; import com.engine.organization.mapper.trigger.CompTriggerMapper;
@ -99,9 +100,14 @@ public class DepartmentTriggerRunnable implements Runnable {
jclMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime())); jclMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
jclMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime())); jclMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
JclOrgMap jclOrgMapByObjID = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapByObjID(currentDate, ModuleTypeEnum.departmentfielddefined.getValue().toString(), jclMap.getFObjId().toString());
jclMap.setFPlan(getDepartmentTriggerMapper().sumStaffNum(jclMap.getFDateBegin(), jclMap.getFObjId())); if (null != jclOrgMapByObjID) {
jclMap.setFOnJob(getDepartmentTriggerMapper().countHrmResource(jclMap.getFEcId())); jclMap.setFPlan(jclOrgMapByObjID.getFPlan());
jclMap.setFOnJob(jclOrgMapByObjID.getFOnJob());
} else {
jclMap.setFPlan(0);
jclMap.setFOnJob(0);
}
jclMap.setFIsVitual(0); jclMap.setFIsVitual(0);
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();

@ -64,13 +64,19 @@ public class GroupTriggerRunnable implements Runnable {
jclOrgMap.setFLeaderSt(cusFieldDataById.getField100008()); jclOrgMap.setFLeaderSt(cusFieldDataById.getField100008());
jclOrgMap.setFLeaderLv(cusFieldDataById.getField100007()); jclOrgMap.setFLeaderLv(cusFieldDataById.getField100007());
} }
jclOrgMap.setFParentId(1); jclOrgMap.setFParentId(-1);
jclOrgMap.setFObjParentId(0); jclOrgMap.setFObjParentId(0);
String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date()); String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date());
jclOrgMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime())); jclOrgMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
jclOrgMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime())); jclOrgMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
jclOrgMap.setFPlan(getGroupTriggerMapper().sumStaffNum(jclOrgMap.getFDateBegin())); JclOrgMap jclOrgMapByObjID = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapByObjID(currentDate, "0", jclOrgMap.getFObjId().toString());
jclOrgMap.setFOnJob(getGroupTriggerMapper().countHrmResource()); if (null != jclOrgMapByObjID) {
jclOrgMap.setFPlan(jclOrgMapByObjID.getFPlan());
jclOrgMap.setFOnJob(jclOrgMapByObjID.getFOnJob());
} else {
jclOrgMap.setFPlan(0);
jclOrgMap.setFOnJob(0);
}
jclOrgMap.setFIsVitual(0); jclOrgMap.setFIsVitual(0);
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
cal.setTime(jclOrgMap.getFDateBegin()); cal.setTime(jclOrgMap.getFDateBegin());

@ -57,8 +57,7 @@ public class HrmResourceTriggerRunnable implements Runnable {
if (null != cusFieldDataById) { if (null != cusFieldDataById) {
String field100002 = cusFieldDataById.getField100002(); String field100002 = cusFieldDataById.getField100002();
if (StringUtils.isNotBlank(field100002)) { if (StringUtils.isNotBlank(field100002)) {
int index = field100002.indexOf('_'); jclMap.setFObjParentId(Integer.parseInt(field100002));
jclMap.setFObjParentId(Integer.parseInt(field100002.substring(index + 1)));
jclMap.setFParentId(jclMap.getFObjParentId() + sj); jclMap.setFParentId(jclMap.getFObjParentId() + sj);
} }
jclMap.setFLeaderSt(cusFieldDataById.getField100008()); jclMap.setFLeaderSt(cusFieldDataById.getField100008());

@ -3,6 +3,7 @@ package com.engine.organization.thread;
import com.engine.organization.entity.job.po.JobPO; import com.engine.organization.entity.job.po.JobPO;
import com.engine.organization.entity.logview.bo.FieldBaseEquator; import com.engine.organization.entity.logview.bo.FieldBaseEquator;
import com.engine.organization.entity.map.JclOrgMap; import com.engine.organization.entity.map.JclOrgMap;
import com.engine.organization.enums.ModuleTypeEnum;
import com.engine.organization.mapper.jclorgmap.JclOrgMapper; import com.engine.organization.mapper.jclorgmap.JclOrgMapper;
import com.engine.organization.mapper.job.JobMapper; import com.engine.organization.mapper.job.JobMapper;
import com.engine.organization.mapper.trigger.CompTriggerMapper; import com.engine.organization.mapper.trigger.CompTriggerMapper;
@ -79,9 +80,14 @@ public class JobTriggerRunnable implements Runnable {
jclMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime())); jclMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
jclMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime())); jclMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
JclOrgMap jclOrgMapByObjID = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapByObjID(currentDate, ModuleTypeEnum.jobfielddefined.getValue().toString(), jclMap.getFObjId().toString());
jclMap.setFPlan(getJobTriggerMapper().sumStaffNum(jclMap.getFDateBegin(), jclMap.getFObjId())); if (null != jclOrgMapByObjID) {
jclMap.setFOnJob(getJobTriggerMapper().countHrmResource(parentdept, jclMap.getFName())); jclMap.setFPlan(jclOrgMapByObjID.getFPlan());
jclMap.setFOnJob(jclOrgMapByObjID.getFOnJob());
} else {
jclMap.setFPlan(0);
jclMap.setFOnJob(0);
}
jclMap.setFIsVitual(0); jclMap.setFIsVitual(0);
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();

@ -219,7 +219,6 @@ public class OrganizationSyncEc {
// 修改岗位表数据 // 修改岗位表数据
this.resultMap = ServiceUtil.getService(HrmJobServiceImpl.class, user).editJobTitle(map, user); this.resultMap = ServiceUtil.getService(HrmJobServiceImpl.class, user).editJobTitle(map, user);
} else { } else {
// TODO 纠正错误数据 临时使用
// 不存在则新建职务 // 不存在则新建职务
map.put("operateIp", Util.null2String(user.getLoginip())); map.put("operateIp", Util.null2String(user.getLoginip()));
map.put("jobtitlemark", newName); map.put("jobtitlemark", newName);

@ -1,14 +1,15 @@
package com.engine.organization.thread; package com.engine.organization.thread;
import com.engine.organization.entity.commom.RecordInfo;
import com.engine.organization.entity.company.po.CompPO; import com.engine.organization.entity.company.po.CompPO;
import com.engine.organization.entity.department.po.DepartmentPO; import com.engine.organization.entity.department.po.DepartmentPO;
import com.engine.organization.entity.job.po.JobPO; import com.engine.organization.entity.job.po.JobPO;
import com.engine.organization.entity.map.JclOrgMap;
import com.engine.organization.entity.staff.po.StaffPO; import com.engine.organization.entity.staff.po.StaffPO;
import com.engine.organization.entity.staff.po.StaffPlanPO; import com.engine.organization.entity.staff.po.StaffPlanPO;
import com.engine.organization.enums.ModuleTypeEnum;
import com.engine.organization.mapper.comp.CompMapper; import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.mapper.department.DepartmentMapper; import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.mapper.hrmresource.SystemDataMapper; import com.engine.organization.mapper.jclorgmap.JclOrgMapper;
import com.engine.organization.mapper.job.JobMapper; import com.engine.organization.mapper.job.JobMapper;
import com.engine.organization.mapper.staff.StaffPlanMapper; import com.engine.organization.mapper.staff.StaffPlanMapper;
import com.engine.organization.mapper.trigger.StaffTriggerMapper; import com.engine.organization.mapper.trigger.StaffTriggerMapper;
@ -16,7 +17,9 @@ import com.engine.organization.util.OrganizationDateUtil;
import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.relation.EcHrmRelationUtil; import com.engine.organization.util.relation.EcHrmRelationUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import weaver.general.Util; import weaver.common.DateUtil;
import java.sql.Date;
/** /**
* @author:dxfeng * @author:dxfeng
@ -46,11 +49,17 @@ public class StaffTriggerRunnable implements Runnable {
return MapperProxyFactory.getProxy(JobMapper.class); return MapperProxyFactory.getProxy(JobMapper.class);
} }
private JclOrgMapper getJclOrgMapper() {
return MapperProxyFactory.getProxy(JclOrgMapper.class);
}
private final String currentDate; private final String currentDate;
private final String yesterday;
public StaffTriggerRunnable(StaffPO staffPO) { public StaffTriggerRunnable(StaffPO staffPO) {
this.staffPO = staffPO; this.staffPO = staffPO;
currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date()); currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date());
yesterday = DateUtil.addDate(currentDate, -1);
} }
@Override @Override
@ -62,18 +71,18 @@ public class StaffTriggerRunnable implements Runnable {
switch (fType) { switch (fType) {
case "1": case "1":
// 更新分部编制 // 更新分部编制
refreshCompanyStaff(staffPO.getCompId(), 0); refreshCompanyStaff(staffPO.getCompId());
break; break;
case "2": case "2":
// 更新部门编制 // 更新部门编制
refreshCompanyStaff(staffPO.getCompId(), 0); refreshDepartmentStaff(staffPO.getDeptId());
refreshDepartmentStaff(staffPO.getDeptId(), 0); refreshCompanyStaff(staffPO.getCompId());
break; break;
case "3": case "3":
// 更新岗位编制 // 更新岗位编制
refreshCompanyStaff(staffPO.getCompId(), 0); refreshJobStaff(staffPO.getJobId());
refreshDepartmentStaff(staffPO.getDeptId(), 0); refreshDepartmentStaff(staffPO.getDeptId());
refreshJobStaff(staffPO.getJobId(), 0); refreshCompanyStaff(staffPO.getCompId());
break; break;
default: default:
break; break;
@ -82,64 +91,86 @@ public class StaffTriggerRunnable implements Runnable {
} }
} }
private void refreshCompanyStaff(Long companyId, Integer fPlan) { private void refreshCompanyStaff(Long companyId) {
if (null == companyId) { if (null == companyId) {
return; return;
} }
CompPO compPO = getCompMapper().listById(companyId); CompPO compPO = getCompMapper().listById(companyId);
if (null != compPO) { if (null != compPO) {
String ecCompanyId = EcHrmRelationUtil.getEcCompanyId(Util.null2String(companyId)); updateOrgMap(ModuleTypeEnum.subcompanyfielddefined.getValue().toString(), companyId.toString());
String fObjId = Util.null2String(companyId);
int fOnJob = getStaffTriggerMapper().countCompanyUsers(ecCompanyId);
Integer staffSum = getStaffTriggerMapper().countCompanyStaffNum(currentDate, companyId);
fPlan += null == staffSum ? 0 : staffSum;
getStaffTriggerMapper().updateOrgStaffs(currentDate, "1", fObjId, fPlan < 0 ? 0 : fPlan, fOnJob);
if (null != compPO.getParentCompany() && 0 != compPO.getParentCompany()) { if (null != compPO.getParentCompany() && 0 != compPO.getParentCompany()) {
refreshCompanyStaff(compPO.getParentCompany(), fPlan); refreshCompanyStaff(compPO.getParentCompany());
} else { } else {
refreshGroupStaff(fPlan); // 刷新集团数据
refreshGroupStaff();
} }
} }
} }
private void refreshDepartmentStaff(Long departmentId, Integer fPlan) { private void refreshDepartmentStaff(Long departmentId) {
if (null == departmentId) { if (null == departmentId) {
return; return;
} }
DepartmentPO deptById = getDepartmentMapper().getDeptById(departmentId); DepartmentPO deptById = getDepartmentMapper().getDeptById(departmentId);
if (null != deptById) { if (null != deptById) {
String ecDepartmentId = EcHrmRelationUtil.getEcDepartmentId(Util.null2String(departmentId)); updateOrgMap(ModuleTypeEnum.departmentfielddefined.getValue().toString(), departmentId.toString());
String fObjId = Util.null2String(departmentId);
int fOnJob = getStaffTriggerMapper().countDepartmentUsers(ecDepartmentId);
Integer staffSum = getStaffTriggerMapper().countDepartmentStaffNum(currentDate, departmentId);
fPlan += null == staffSum ? 0 : staffSum;
getStaffTriggerMapper().updateOrgStaffs(currentDate, "2", fObjId, fPlan < 0 ? 0 : fPlan, fOnJob);
if (null != deptById.getParentDept() && 0 != deptById.getParentDept()) { if (null != deptById.getParentDept() && 0 != deptById.getParentDept()) {
refreshDepartmentStaff(deptById.getParentDept(), fPlan); refreshDepartmentStaff(deptById.getParentDept());
} }
} }
} }
private void refreshJobStaff(Long jobId, Integer fPlan) { private void refreshJobStaff(Long jobId) {
if (null == jobId) { if (null == jobId) {
return; return;
} }
JobPO jobById = getJobMapper().getJobById(jobId); JobPO jobById = getJobMapper().getJobById(jobId);
if (null != jobById) { if (null != jobById) {
String fObjId = Util.null2String(jobId); updateOrgMap(ModuleTypeEnum.jobfielddefined.getValue().toString(), jobId.toString());
RecordInfo hrmJobTitleByName = MapperProxyFactory.getProxy(SystemDataMapper.class).getHrmJobTitleByName(jobById.getJobName()); if (null != jobById.getParentJob() && 0 != jobById.getParentJob()) {
int fOnJob = getStaffTriggerMapper().countJobUsers(hrmJobTitleByName.getId()); refreshJobStaff(jobById.getParentJob());
Integer staffSum = getStaffTriggerMapper().countJobStaffNum(currentDate, jobId); }
fPlan += null == staffSum ? 0 : staffSum;
getStaffTriggerMapper().updateOrgStaffs(currentDate, "3", fObjId, fPlan < 0 ? 0 : fPlan, fOnJob);
//if (null != jobById.getParentJob() && 0 != jobById.getParentJob()) {
// refreshJobStaff(jobById.getParentJob(), fPlan);
//}
} }
} }
private void refreshGroupStaff(Integer fPlan) { private void refreshGroupStaff() {
Integer fOnJob = getStaffTriggerMapper().countAllusers(); updateOrgMap("0", "0");
getStaffTriggerMapper().updateOrgStaffs(currentDate, "0", "0", fPlan < 0 ? 0 : fPlan, fOnJob); }
private void updateOrgMap(String type, String objId) {
Integer planSum = 0;
Integer onJobSum = 0;
switch (type) {
case "1":
planSum = getStaffTriggerMapper().countCompanyStaffNum(currentDate, objId);
break;
case "2":
planSum = getStaffTriggerMapper().countDepartmentStaffNum(currentDate, objId);
break;
case "3":
planSum = getStaffTriggerMapper().countJobStaffNum(currentDate, objId);
String ecJobId = EcHrmRelationUtil.getEcJobId(Long.parseLong(objId));
onJobSum = getStaffTriggerMapper().countJobUsers(ecJobId);
default:
break;
}
JclOrgMap jclOrgMapByObjID = getJclOrgMapper().getJclOrgMapByObjID(currentDate, type, objId);
String mapInfoId = getStaffTriggerMapper().getIdByObjIdAndType(currentDate, objId, type);
Integer childPlanSum = getStaffTriggerMapper().sumPlanByParentId(currentDate, mapInfoId);
Integer childOnJobSum = getStaffTriggerMapper().sumOnJobByParentId(currentDate, mapInfoId);
getJclOrgMapper().deleteMap(type, objId, currentDate);
getJclOrgMapper().updateMap(type, objId, currentDate, yesterday);
jclOrgMapByObjID.setFPlan(addInteger(planSum, childPlanSum));
jclOrgMapByObjID.setFOnJob(addInteger(onJobSum, childOnJobSum));
jclOrgMapByObjID.setFDateBegin(new Date(System.currentTimeMillis()));
getJclOrgMapper().insertMap(jclOrgMapByObjID);
}
private Integer addInteger(Integer num1, Integer num2) {
num1 = num1 == null ? 0 : num1;
num2 = num2 == null ? 0 : num2;
return num1 + num2;
} }
} }

@ -93,6 +93,18 @@ public class EcHrmRelationUtil {
return getDepartmentMapper().getDepartmentByUUID(uuid); return getDepartmentMapper().getDepartmentByUUID(uuid);
} }
public static String getEcJobId(Long jclJobId) {
JobPO jobById = getJobMapper().getJobById(jclJobId);
if (null == jobById) {
return "";
}
RecordInfo hrmJobTitleByName = MapperProxyFactory.getProxy(SystemDataMapper.class).getHrmJobTitleByName(jobById.getJobName());
if (null == hrmJobTitleByName) {
return "";
}
return hrmJobTitleByName.getId();
}
/** /**
* *

@ -282,7 +282,6 @@ public class HrmImportAdaptExcelE9 extends BaseBean implements IHrmImportAdapt {
cellValue = getCellValue(cell).trim(); cellValue = getCellValue(cell).trim();
for (int k = 0; k < temFields.length; k++) { for (int k = 0; k < temFields.length; k++) {
if (cellValue.equals(temFields[k])) { if (cellValue.equals(temFields[k])) {
// TODO 初始化必填字段下标
String requiredFields = "所属分部,部门,姓名,岗位,职务,职务类别,办公地点"; String requiredFields = "所属分部,部门,姓名,岗位,职务,职务类别,办公地点";
requiredFields = "所属分部,部门,登录名,姓名,性别,状态,办公地点,入职日期,参加工作日期,担任岗位,职等职级,担任职务"; requiredFields = "所属分部,部门,登录名,姓名,性别,状态,办公地点,入职日期,参加工作日期,担任岗位,职等职级,担任职务";
List<String> requiredFieldList = Arrays.asList(requiredFields.split(",")); List<String> requiredFieldList = Arrays.asList(requiredFields.split(","));

@ -5,7 +5,7 @@ import com.engine.organization.entity.staff.po.StaffPO;
import com.engine.organization.entity.staff.po.StaffsPO; import com.engine.organization.entity.staff.po.StaffsPO;
import com.engine.organization.mapper.staff.StaffMapper; import com.engine.organization.mapper.staff.StaffMapper;
import com.engine.organization.mapper.staff.StaffsMapper; import com.engine.organization.mapper.staff.StaffsMapper;
import com.engine.organization.thread.StaffTriggerRunnable; import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.db.MapperProxyFactory;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -77,6 +77,9 @@ public class StaffChangeAction implements Action {
} }
} }
if (null == changeNum) {
return "编制变动数必填";
}
if (changeNum < 0) { if (changeNum < 0) {
return "编制变动数需大于0"; return "编制变动数需大于0";
} }
@ -111,6 +114,7 @@ public class StaffChangeAction implements Action {
case "6":// 减员释放,比如离职、调出等 case "6":// 减员释放,比如离职、调出等
staffPO.setPermanentNum(staffPO.getPermanentNum() - changeNum); staffPO.setPermanentNum(staffPO.getPermanentNum() - changeNum);
if (staffPO.getPermanentNum() < 0) { if (staffPO.getPermanentNum() < 0) {
OrganizationAssert.isFalse(staffPO.getPermanentNum() < 0,"调整数量不可大于在编数");
return "调整数量不可大于在编数"; return "调整数量不可大于在编数";
} }
break; break;
@ -137,7 +141,7 @@ public class StaffChangeAction implements Action {
StaffBO.buildStaffDesc(staffPO); StaffBO.buildStaffDesc(staffPO);
MapperProxyFactory.getProxy(StaffMapper.class).updateStaff(staffPO); MapperProxyFactory.getProxy(StaffMapper.class).updateStaff(staffPO);
// 同步组织架构图编制信息 // 同步组织架构图编制信息
new Thread(new StaffTriggerRunnable(staffPO)).start(); // new Thread(new StaffTriggerRunnable(staffPO)).start();
return SUCCESS; return SUCCESS;
} }

Loading…
Cancel
Save