diff --git a/docs/非标从发SQL脚本/MySQL.sql b/docs/非标从发SQL脚本/MySQL.sql new file mode 100644 index 00000000..da415326 --- /dev/null +++ b/docs/非标从发SQL脚本/MySQL.sql @@ -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 ); diff --git a/docs/非标从发SQL脚本/Oracle.sql b/docs/非标从发SQL脚本/Oracle.sql new file mode 100644 index 00000000..258e7b87 --- /dev/null +++ b/docs/非标从发SQL脚本/Oracle.sql @@ -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 ); diff --git a/docs/非标从发SQL脚本/SqlServer.sql b/docs/非标从发SQL脚本/SqlServer.sql new file mode 100644 index 00000000..680dad19 --- /dev/null +++ b/docs/非标从发SQL脚本/SqlServer.sql @@ -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 ); diff --git a/src/com/engine/organization/entity/department/dto/DepartmentListDTO.java b/src/com/engine/organization/entity/department/dto/DepartmentListDTO.java index 94e401ba..4da3d4ea 100644 --- a/src/com/engine/organization/entity/department/dto/DepartmentListDTO.java +++ b/src/com/engine/organization/entity/department/dto/DepartmentListDTO.java @@ -33,7 +33,7 @@ public class DepartmentListDTO { /** * 名称 */ - @TableTitle(title = "名称", dataIndex = "deptName", key = "deptName") + @TableTitle(title = "名称", dataIndex = "deptName", key = "deptName",width = "200") private String deptName; /** diff --git a/src/com/engine/organization/mapper/jclorgmap/JclOrgMapper.java b/src/com/engine/organization/mapper/jclorgmap/JclOrgMapper.java index 0ff44758..d813aeba 100644 --- a/src/com/engine/organization/mapper/jclorgmap/JclOrgMapper.java +++ b/src/com/engine/organization/mapper/jclorgmap/JclOrgMapper.java @@ -1,6 +1,7 @@ package com.engine.organization.mapper.jclorgmap; import com.engine.organization.entity.map.JclOrgMap; +import org.apache.ibatis.annotations.Param; /** * @author:dxfeng @@ -9,4 +10,10 @@ import com.engine.organization.entity.map.JclOrgMap; */ public interface JclOrgMapper { 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); } diff --git a/src/com/engine/organization/mapper/jclorgmap/JclOrgMapper.xml b/src/com/engine/organization/mapper/jclorgmap/JclOrgMapper.xml index df066023..0543cefb 100644 --- a/src/com/engine/organization/mapper/jclorgmap/JclOrgMapper.xml +++ b/src/com/engine/organization/mapper/jclorgmap/JclOrgMapper.xml @@ -13,4 +13,26 @@ #{fObjParentId}, #{fPlan}, #{fOnJob}, #{fIsVitual}, #{fDateBegin}, #{fDateEnd}) + + update jcl_org_map + + fdateend=#{currentDate}, + + where ftype=#{ftype} and fobjid=#{fobjid} and fdateend > #{currentDate} + + + delete + from jcl_org_map + where ftype = #{ftype} + and fobjid = #{fobjid} + and fdatebegin = #{currentDate} + + \ No newline at end of file diff --git a/src/com/engine/organization/mapper/trigger/GroupTriggerMapper.xml b/src/com/engine/organization/mapper/trigger/GroupTriggerMapper.xml index d204f765..41087495 100644 --- a/src/com/engine/organization/mapper/trigger/GroupTriggerMapper.xml +++ b/src/com/engine/organization/mapper/trigger/GroupTriggerMapper.xml @@ -3,7 +3,7 @@ update jcl_org_map - set fdateend=dateadd(day,-1, #{fdate}) + set fdateend=#{fdate} where fobjid = #{fobjid} and fdateend > #{fdatebegin} diff --git a/src/com/engine/organization/mapper/trigger/StaffTriggerMapper.java b/src/com/engine/organization/mapper/trigger/StaffTriggerMapper.java index 7c9dbb5e..4f46e679 100644 --- a/src/com/engine/organization/mapper/trigger/StaffTriggerMapper.java +++ b/src/com/engine/organization/mapper/trigger/StaffTriggerMapper.java @@ -8,19 +8,25 @@ import org.apache.ibatis.annotations.Param; * @version: 1.0 */ 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 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); + + 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); } diff --git a/src/com/engine/organization/mapper/trigger/StaffTriggerMapper.xml b/src/com/engine/organization/mapper/trigger/StaffTriggerMapper.xml index 04a9aaaa..5577bf99 100644 --- a/src/com/engine/organization/mapper/trigger/StaffTriggerMapper.xml +++ b/src/com/engine/organization/mapper/trigger/StaffTriggerMapper.xml @@ -32,7 +32,7 @@ where status <= 3 and jobtitle = #{jobTitle} - select count(1) from hrmresource where status <= 3 @@ -44,7 +44,8 @@ from JCL_ORG_STAFFPLAN where time_start <= #{currentDate} and time_end >= #{currentDate} - and delete_type = 0) + and delete_type = 0 + and control_dimension = 1) and comp_id = #{companyId} and delete_type = 0 @@ -55,7 +56,8 @@ from JCL_ORG_STAFFPLAN where time_start <= #{currentDate} and time_end >= #{currentDate} - and delete_type = 0) + and delete_type = 0 + and control_dimension = 2) and dept_id = #{departmentId} and delete_type = 0 @@ -66,8 +68,31 @@ from JCL_ORG_STAFFPLAN where time_start <= #{currentDate} and time_end >= #{currentDate} - and delete_type = 0) + and delete_type = 0 + and control_dimension = 3) and job_id = #{jobId} and delete_type = 0 + + + \ No newline at end of file diff --git a/src/com/engine/organization/service/impl/DepartmentServiceImpl.java b/src/com/engine/organization/service/impl/DepartmentServiceImpl.java index 3c6c1e16..8e9f1964 100644 --- a/src/com/engine/organization/service/impl/DepartmentServiceImpl.java +++ b/src/com/engine/organization/service/impl/DepartmentServiceImpl.java @@ -532,6 +532,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService deptById.setShowOrder(++maxShowOrder); deptById.setCreator((long) user.getUID()); deptById.setCreateTime(new Date()); + deptById.setDeptPrincipal(null); // 新增EC表部门 Map syncMap = addEcDepartment(deptById); diff --git a/src/com/engine/organization/service/impl/ImportCommonServiceImpl.java b/src/com/engine/organization/service/impl/ImportCommonServiceImpl.java index 3a54aa89..d5e703f9 100644 --- a/src/com/engine/organization/service/impl/ImportCommonServiceImpl.java +++ b/src/com/engine/organization/service/impl/ImportCommonServiceImpl.java @@ -721,6 +721,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ historyDetailPO.setOperateDetail("未找到对应数据"); historyDetailPO.setStatus("0"); saveImportDetailLog(historyDetailPO); + continue; } if (checkRepeatNo(compNo, COMPANY_TYPE, companyId)) { 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("parent_dept", 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]; map.put("dept_name", departmentName); @@ -937,6 +938,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ historyDetailPO.setOperateDetail("未找到对应数据"); historyDetailPO.setStatus("0"); saveImportDetailLog(historyDetailPO); + continue; } if (checkRepeatNo(deptNo, DEPARTMENT_TYPE, departmentId)) { map.put("update_time", new Date()); @@ -1182,6 +1184,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ historyDetailPO.setOperateDetail("未找到对应数据"); historyDetailPO.setStatus("0"); saveImportDetailLog(historyDetailPO); + continue; } if (checkRepeatNo(jobNo, JOB_TYPE, jobId)) { map.put("update_time", new Date()); @@ -1189,7 +1192,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ map.put("id", jobId); Map syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.JOB, OperateTypeEnum.UPDATE, map, MapperProxyFactory.getProxy(JobMapper.class).getJobById(jobId), false).sync(); 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) { map.remove("id"); map.remove("jobactivityid"); diff --git a/src/com/engine/organization/service/impl/StaffServiceImpl.java b/src/com/engine/organization/service/impl/StaffServiceImpl.java index 99675106..ae276303 100644 --- a/src/com/engine/organization/service/impl/StaffServiceImpl.java +++ b/src/com/engine/organization/service/impl/StaffServiceImpl.java @@ -234,6 +234,7 @@ public class StaffServiceImpl extends Service implements StaffService { // 编制数 SearchConditionItem staffNumItem = OrganizationFormItemUtil.inputNumberItem(user, 2, 16, 3, "编制数", "staffNum"); staffNumItem.setRules("required"); + staffNumItem.setMin("0"); // 控制策略 List selectOptions = new ArrayList<>(); SearchConditionOption option1 = new SearchConditionOption("1", "弱控"); @@ -340,7 +341,7 @@ public class StaffServiceImpl extends Service implements StaffService { if (null != planId) { sqlWhere += " AND t.plan_id = '" + planId + "'"; } else { - sqlWhere = " 1=2 "; + sqlWhere = " where 1 = 2 "; } Long compId = param.getCompId(); if (null != compId) { diff --git a/src/com/engine/organization/thread/CompanyTriggerRunnable.java b/src/com/engine/organization/thread/CompanyTriggerRunnable.java index c3a0941c..955acf13 100644 --- a/src/com/engine/organization/thread/CompanyTriggerRunnable.java +++ b/src/com/engine/organization/thread/CompanyTriggerRunnable.java @@ -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.logview.bo.FieldBaseEquator; 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.jclorgmap.JclOrgMapper; 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.setFPlan(getCompTriggerMapper().sumStaffNum(jclMap.getFDateBegin(), jclMap.getFObjId())); - jclMap.setFOnJob(getCompTriggerMapper().countHrmResource(jclMap.getFEcId())); + JclOrgMap jclOrgMapByObjID = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapByObjID(currentDate, ModuleTypeEnum.subcompanyfielddefined.getValue().toString(), jclMap.getFObjId().toString()); + if (null != jclOrgMapByObjID) { + jclMap.setFPlan(jclOrgMapByObjID.getFPlan()); + jclMap.setFOnJob(jclOrgMapByObjID.getFOnJob()); + } else { + jclMap.setFPlan(0); + jclMap.setFOnJob(0); + } jclMap.setFIsVitual(0); Calendar cal = Calendar.getInstance(); diff --git a/src/com/engine/organization/thread/DepartmentTriggerRunnable.java b/src/com/engine/organization/thread/DepartmentTriggerRunnable.java index af1fb673..66f30569 100644 --- a/src/com/engine/organization/thread/DepartmentTriggerRunnable.java +++ b/src/com/engine/organization/thread/DepartmentTriggerRunnable.java @@ -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.logview.bo.FieldBaseEquator; 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.jclorgmap.JclOrgMapper; 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.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime())); - - jclMap.setFPlan(getDepartmentTriggerMapper().sumStaffNum(jclMap.getFDateBegin(), jclMap.getFObjId())); - jclMap.setFOnJob(getDepartmentTriggerMapper().countHrmResource(jclMap.getFEcId())); + JclOrgMap jclOrgMapByObjID = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapByObjID(currentDate, ModuleTypeEnum.departmentfielddefined.getValue().toString(), jclMap.getFObjId().toString()); + if (null != jclOrgMapByObjID) { + jclMap.setFPlan(jclOrgMapByObjID.getFPlan()); + jclMap.setFOnJob(jclOrgMapByObjID.getFOnJob()); + } else { + jclMap.setFPlan(0); + jclMap.setFOnJob(0); + } jclMap.setFIsVitual(0); Calendar cal = Calendar.getInstance(); diff --git a/src/com/engine/organization/thread/GroupTriggerRunnable.java b/src/com/engine/organization/thread/GroupTriggerRunnable.java index c18a9b18..38ac3087 100644 --- a/src/com/engine/organization/thread/GroupTriggerRunnable.java +++ b/src/com/engine/organization/thread/GroupTriggerRunnable.java @@ -64,13 +64,19 @@ public class GroupTriggerRunnable implements Runnable { jclOrgMap.setFLeaderSt(cusFieldDataById.getField100008()); jclOrgMap.setFLeaderLv(cusFieldDataById.getField100007()); } - jclOrgMap.setFParentId(1); + jclOrgMap.setFParentId(-1); jclOrgMap.setFObjParentId(0); String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date()); jclOrgMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime())); jclOrgMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime())); - jclOrgMap.setFPlan(getGroupTriggerMapper().sumStaffNum(jclOrgMap.getFDateBegin())); - jclOrgMap.setFOnJob(getGroupTriggerMapper().countHrmResource()); + JclOrgMap jclOrgMapByObjID = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapByObjID(currentDate, "0", jclOrgMap.getFObjId().toString()); + if (null != jclOrgMapByObjID) { + jclOrgMap.setFPlan(jclOrgMapByObjID.getFPlan()); + jclOrgMap.setFOnJob(jclOrgMapByObjID.getFOnJob()); + } else { + jclOrgMap.setFPlan(0); + jclOrgMap.setFOnJob(0); + } jclOrgMap.setFIsVitual(0); Calendar cal = Calendar.getInstance(); cal.setTime(jclOrgMap.getFDateBegin()); diff --git a/src/com/engine/organization/thread/HrmResourceTriggerRunnable.java b/src/com/engine/organization/thread/HrmResourceTriggerRunnable.java index 9ae6ad7c..97de746c 100644 --- a/src/com/engine/organization/thread/HrmResourceTriggerRunnable.java +++ b/src/com/engine/organization/thread/HrmResourceTriggerRunnable.java @@ -57,8 +57,7 @@ public class HrmResourceTriggerRunnable implements Runnable { if (null != cusFieldDataById) { String field100002 = cusFieldDataById.getField100002(); if (StringUtils.isNotBlank(field100002)) { - int index = field100002.indexOf('_'); - jclMap.setFObjParentId(Integer.parseInt(field100002.substring(index + 1))); + jclMap.setFObjParentId(Integer.parseInt(field100002)); jclMap.setFParentId(jclMap.getFObjParentId() + sj); } jclMap.setFLeaderSt(cusFieldDataById.getField100008()); diff --git a/src/com/engine/organization/thread/JobTriggerRunnable.java b/src/com/engine/organization/thread/JobTriggerRunnable.java index 685b4d31..79fb9dd7 100644 --- a/src/com/engine/organization/thread/JobTriggerRunnable.java +++ b/src/com/engine/organization/thread/JobTriggerRunnable.java @@ -3,6 +3,7 @@ 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.enums.ModuleTypeEnum; import com.engine.organization.mapper.jclorgmap.JclOrgMapper; import com.engine.organization.mapper.job.JobMapper; 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.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime())); - - jclMap.setFPlan(getJobTriggerMapper().sumStaffNum(jclMap.getFDateBegin(), jclMap.getFObjId())); - jclMap.setFOnJob(getJobTriggerMapper().countHrmResource(parentdept, jclMap.getFName())); + JclOrgMap jclOrgMapByObjID = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapByObjID(currentDate, ModuleTypeEnum.jobfielddefined.getValue().toString(), jclMap.getFObjId().toString()); + if (null != jclOrgMapByObjID) { + jclMap.setFPlan(jclOrgMapByObjID.getFPlan()); + jclMap.setFOnJob(jclOrgMapByObjID.getFOnJob()); + } else { + jclMap.setFPlan(0); + jclMap.setFOnJob(0); + } jclMap.setFIsVitual(0); Calendar cal = Calendar.getInstance(); diff --git a/src/com/engine/organization/thread/OrganizationSyncEc.java b/src/com/engine/organization/thread/OrganizationSyncEc.java index 22478ff7..db631845 100644 --- a/src/com/engine/organization/thread/OrganizationSyncEc.java +++ b/src/com/engine/organization/thread/OrganizationSyncEc.java @@ -219,7 +219,6 @@ public class OrganizationSyncEc { // 修改岗位表数据 this.resultMap = ServiceUtil.getService(HrmJobServiceImpl.class, user).editJobTitle(map, user); } else { - // TODO 纠正错误数据 临时使用 // 不存在则新建职务 map.put("operateIp", Util.null2String(user.getLoginip())); map.put("jobtitlemark", newName); diff --git a/src/com/engine/organization/thread/StaffTriggerRunnable.java b/src/com/engine/organization/thread/StaffTriggerRunnable.java index e263f818..6bbf2be1 100644 --- a/src/com/engine/organization/thread/StaffTriggerRunnable.java +++ b/src/com/engine/organization/thread/StaffTriggerRunnable.java @@ -1,14 +1,15 @@ 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.department.po.DepartmentPO; 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.StaffPlanPO; +import com.engine.organization.enums.ModuleTypeEnum; import com.engine.organization.mapper.comp.CompMapper; import com.engine.organization.mapper.department.DepartmentMapper; -import com.engine.organization.mapper.hrmresource.SystemDataMapper; +import com.engine.organization.mapper.jclorgmap.JclOrgMapper; import com.engine.organization.mapper.job.JobMapper; import com.engine.organization.mapper.staff.StaffPlanMapper; 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.relation.EcHrmRelationUtil; import org.apache.commons.lang3.StringUtils; -import weaver.general.Util; +import weaver.common.DateUtil; + +import java.sql.Date; /** * @author:dxfeng @@ -46,11 +49,17 @@ public class StaffTriggerRunnable implements Runnable { return MapperProxyFactory.getProxy(JobMapper.class); } + private JclOrgMapper getJclOrgMapper() { + return MapperProxyFactory.getProxy(JclOrgMapper.class); + } + private final String currentDate; + private final String yesterday; public StaffTriggerRunnable(StaffPO staffPO) { this.staffPO = staffPO; currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date()); + yesterday = DateUtil.addDate(currentDate, -1); } @Override @@ -62,18 +71,18 @@ public class StaffTriggerRunnable implements Runnable { switch (fType) { case "1": // 更新分部编制 - refreshCompanyStaff(staffPO.getCompId(), 0); + refreshCompanyStaff(staffPO.getCompId()); break; case "2": // 更新部门编制 - refreshCompanyStaff(staffPO.getCompId(), 0); - refreshDepartmentStaff(staffPO.getDeptId(), 0); + refreshDepartmentStaff(staffPO.getDeptId()); + refreshCompanyStaff(staffPO.getCompId()); break; case "3": // 更新岗位编制 - refreshCompanyStaff(staffPO.getCompId(), 0); - refreshDepartmentStaff(staffPO.getDeptId(), 0); - refreshJobStaff(staffPO.getJobId(), 0); + refreshJobStaff(staffPO.getJobId()); + refreshDepartmentStaff(staffPO.getDeptId()); + refreshCompanyStaff(staffPO.getCompId()); break; default: 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) { return; } CompPO compPO = getCompMapper().listById(companyId); if (null != compPO) { - String ecCompanyId = EcHrmRelationUtil.getEcCompanyId(Util.null2String(companyId)); - 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); + updateOrgMap(ModuleTypeEnum.subcompanyfielddefined.getValue().toString(), companyId.toString()); if (null != compPO.getParentCompany() && 0 != compPO.getParentCompany()) { - refreshCompanyStaff(compPO.getParentCompany(), fPlan); + refreshCompanyStaff(compPO.getParentCompany()); } else { - refreshGroupStaff(fPlan); + // 刷新集团数据 + refreshGroupStaff(); } } } - private void refreshDepartmentStaff(Long departmentId, Integer fPlan) { + private void refreshDepartmentStaff(Long departmentId) { if (null == departmentId) { return; } DepartmentPO deptById = getDepartmentMapper().getDeptById(departmentId); if (null != deptById) { - String ecDepartmentId = EcHrmRelationUtil.getEcDepartmentId(Util.null2String(departmentId)); - 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); + updateOrgMap(ModuleTypeEnum.departmentfielddefined.getValue().toString(), departmentId.toString()); 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) { return; } JobPO jobById = getJobMapper().getJobById(jobId); if (null != jobById) { - String fObjId = Util.null2String(jobId); - RecordInfo hrmJobTitleByName = MapperProxyFactory.getProxy(SystemDataMapper.class).getHrmJobTitleByName(jobById.getJobName()); - int fOnJob = getStaffTriggerMapper().countJobUsers(hrmJobTitleByName.getId()); - 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); - //} + updateOrgMap(ModuleTypeEnum.jobfielddefined.getValue().toString(), jobId.toString()); + if (null != jobById.getParentJob() && 0 != jobById.getParentJob()) { + refreshJobStaff(jobById.getParentJob()); + } } } - private void refreshGroupStaff(Integer fPlan) { - Integer fOnJob = getStaffTriggerMapper().countAllusers(); - getStaffTriggerMapper().updateOrgStaffs(currentDate, "0", "0", fPlan < 0 ? 0 : fPlan, fOnJob); + private void refreshGroupStaff() { + updateOrgMap("0", "0"); + } + + + 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; } } diff --git a/src/com/engine/organization/util/relation/EcHrmRelationUtil.java b/src/com/engine/organization/util/relation/EcHrmRelationUtil.java index 53ab7152..d46c789b 100644 --- a/src/com/engine/organization/util/relation/EcHrmRelationUtil.java +++ b/src/com/engine/organization/util/relation/EcHrmRelationUtil.java @@ -93,6 +93,18 @@ public class EcHrmRelationUtil { 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(); + } + /** * 判断岗位名称是否共用 diff --git a/src/com/engine/organization/util/saveimport/hrmimport/HrmImportAdaptExcelE9.java b/src/com/engine/organization/util/saveimport/hrmimport/HrmImportAdaptExcelE9.java index 7245c291..4769b914 100644 --- a/src/com/engine/organization/util/saveimport/hrmimport/HrmImportAdaptExcelE9.java +++ b/src/com/engine/organization/util/saveimport/hrmimport/HrmImportAdaptExcelE9.java @@ -282,7 +282,6 @@ public class HrmImportAdaptExcelE9 extends BaseBean implements IHrmImportAdapt { cellValue = getCellValue(cell).trim(); for (int k = 0; k < temFields.length; k++) { if (cellValue.equals(temFields[k])) { - // TODO 初始化必填字段下标 String requiredFields = "所属分部,部门,姓名,岗位,职务,职务类别,办公地点"; requiredFields = "所属分部,部门,登录名,姓名,性别,状态,办公地点,入职日期,参加工作日期,担任岗位,职等职级,担任职务"; List requiredFieldList = Arrays.asList(requiredFields.split(",")); diff --git a/src/weaver/interfaces/organization/action/StaffChangeAction.java b/src/weaver/interfaces/organization/action/StaffChangeAction.java index 0f50638c..ff324f69 100644 --- a/src/weaver/interfaces/organization/action/StaffChangeAction.java +++ b/src/weaver/interfaces/organization/action/StaffChangeAction.java @@ -5,7 +5,7 @@ import com.engine.organization.entity.staff.po.StaffPO; import com.engine.organization.entity.staff.po.StaffsPO; import com.engine.organization.mapper.staff.StaffMapper; 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 org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -77,6 +77,9 @@ public class StaffChangeAction implements Action { } } + if (null == changeNum) { + return "编制变动数必填"; + } if (changeNum < 0) { return "编制变动数需大于0"; } @@ -111,6 +114,7 @@ public class StaffChangeAction implements Action { case "6":// 减员释放,比如离职、调出等 staffPO.setPermanentNum(staffPO.getPermanentNum() - changeNum); if (staffPO.getPermanentNum() < 0) { + OrganizationAssert.isFalse(staffPO.getPermanentNum() < 0,"调整数量不可大于在编数"); return "调整数量不可大于在编数"; } break; @@ -137,7 +141,7 @@ public class StaffChangeAction implements Action { StaffBO.buildStaffDesc(staffPO); MapperProxyFactory.getProxy(StaffMapper.class).updateStaff(staffPO); // 同步组织架构图编制信息 - new Thread(new StaffTriggerRunnable(staffPO)).start(); + // new Thread(new StaffTriggerRunnable(staffPO)).start(); return SUCCESS; }