diff --git a/WEB-INF/lib/poi-ooxml-4.0.1.jar b/WEB-INF/lib/poi-ooxml-4.0.1.jar new file mode 100755 index 00000000..282a1a52 Binary files /dev/null and b/WEB-INF/lib/poi-ooxml-4.0.1.jar differ diff --git a/docs/初始数据SQL/jcl_field_extendgroup.sql b/docs/初始数据SQL/jcl_field_extendgroup.sql index 9f9f9bb8..6dd1fc25 100644 --- a/docs/初始数据SQL/jcl_field_extendgroup.sql +++ b/docs/初始数据SQL/jcl_field_extendgroup.sql @@ -6,7 +6,10 @@ INSERT INTO jcl_field_extendgroup VALUES(2, 2, '基本信息', 1, 0, '2022-06-17', '2022-06-17', NULL, '1', 1, 0); INSERT INTO jcl_field_extendgroup (id, extend_type, group_name, creator, delete_type, create_time, update_time, pid, is_show, show_order, is_system_default) -VALUES(3, 3, '基本信息', 1, 0, '2022-06-17', '2022-06-17', NULL, '1', 1, 0); +VALUES(3, 3, '基础信息', 1, 0, '2022-06-17', '2022-06-17', NULL, '1', 1, 0); INSERT INTO jcl_field_extendgroup (id, extend_type, group_name, creator, delete_type, create_time, update_time, pid, is_show, show_order, is_system_default) VALUES(4, 4, '基本信息', 1, 0, '2022-06-17', '2022-06-17', NULL, '1', 1, 0); +INSERT INTO jcl_field_extendgroup +(id, extend_type, group_name, creator, delete_type, create_time, update_time, pid, is_show, show_order, is_system_default) +VALUES(5, 3, '职务', 1, 0, '2022-07-05', '2022-07-05', 3, '1', 1, 1); diff --git a/docs/表结构SQL/MySQL.sql b/docs/表结构SQL/MySQL.sql index e4d88dd4..9f0e7172 100644 --- a/docs/表结构SQL/MySQL.sql +++ b/docs/表结构SQL/MySQL.sql @@ -1,133 +1,133 @@ -- JCL_ORG_SCHEME CREATE TABLE JCL_ORG_SCHEME ( - id int auto_increment NOT NULL, - scheme_no varchar(100) NULL, - scheme_name varchar(100) NULL, - scheme_description text NULL, - forbidden_tag int NULL, - is_used int null, - creator int null, - delete_type int null, - create_time date null, - update_time date null, - CONSTRAINT JCL_ORG_SCHEME_PK PRIMARY KEY (id) + id int auto_increment NOT NULL, + scheme_no varchar(100) NULL, + scheme_name varchar(100) NULL, + scheme_description text NULL, + forbidden_tag int NULL, + is_used int null, + creator int null, + delete_type int null, + create_time date null, + update_time date null, + CONSTRAINT JCL_ORG_SCHEME_PK PRIMARY KEY (id) ); -- JCL_ORG_LEVEL CREATE TABLE JCL_ORG_LEVEL ( - id int auto_increment NOT NULL, - level_no varchar(100) NULL, - level_name varchar(100) NULL, - description text NULL, - scheme_id int null, - forbidden_tag int NULL, - is_used int null, - creator int null, - delete_type int null, - create_time date null, - update_time date null, - CONSTRAINT JCL_ORG_LEVEL_PK PRIMARY KEY (id) + id int auto_increment NOT NULL, + level_no varchar(100) NULL, + level_name varchar(100) NULL, + description text NULL, + scheme_id int null, + forbidden_tag int NULL, + is_used int null, + creator int null, + delete_type int null, + create_time date null, + update_time date null, + CONSTRAINT JCL_ORG_LEVEL_PK PRIMARY KEY (id) ); -- JCL_ORG_GRADE CREATE TABLE JCL_ORG_GRADE ( - id int auto_increment NOT NULL, - grade_no varchar(100) NULL, - grade_name varchar(100) NULL, - description text NULL, - scheme_id int null, - level_id varchar(100) null, - forbidden_tag int NULL, + id int auto_increment NOT NULL, + grade_no varchar(100) NULL, + grade_name varchar(100) NULL, + description text NULL, + scheme_id int null, + level_id varchar(100) null, + forbidden_tag int NULL, is_used int null, - creator int null, - delete_type int null, - create_time date null, - update_time date null, - CONSTRAINT JCL_ORG_GRADE_PK PRIMARY KEY (id) + creator int null, + delete_type int null, + create_time date null, + update_time date null, + CONSTRAINT JCL_ORG_GRADE_PK PRIMARY KEY (id) ); -- JCL_ORG_SEQUENCE CREATE TABLE JCL_ORG_SEQUENCE ( - id int auto_increment NOT NULL, - sequence_no varchar(100) NULL, - sequence_name varchar(100) NULL, - description text NULL, - scheme_id int null, - forbidden_tag int NULL, + id int auto_increment NOT NULL, + sequence_no varchar(100) NULL, + sequence_name varchar(100) NULL, + description text NULL, + scheme_id int null, + forbidden_tag int NULL, is_used int null, - creator int null, - delete_type int null, - create_time date null, - update_time date null, - CONSTRAINT JCL_ORG_SEQUENCE_PK PRIMARY KEY (id) + creator int null, + delete_type int null, + create_time date null, + update_time date null, + CONSTRAINT JCL_ORG_SEQUENCE_PK PRIMARY KEY (id) ); -- JCL_ORG_POST CREATE TABLE JCL_ORG_POST ( - id int auto_increment NOT NULL, - post_no varchar(100) null, - post_name varchar(100) NULL, - description text NULL, + id int auto_increment NOT NULL, + post_no varchar(100) null, + post_name varchar(100) NULL, + description text NULL, is_used int null, - creator int null, - delete_type int null, - create_time date null, - update_time date null, - CONSTRAINT JCL_ORG_POST_PK PRIMARY KEY (id) + creator int null, + delete_type int null, + create_time date null, + update_time date null, + CONSTRAINT JCL_ORG_POST_PK PRIMARY KEY (id) ); -- JCL_ORG_POST_INFO CREATE TABLE JCL_ORG_POST_INFO ( - id int auto_increment NOT NULL, - post_info_no varchar(100) null, - post_info_name varchar(100) NULL, - post_info_authority text null, - post_info_duty text null, - post_info_qualification text null, - post_id int null, - description text NULL, - forbidden_tag int NULL, + id int auto_increment NOT NULL, + post_info_no varchar(100) null, + post_info_name varchar(100) NULL, + post_info_authority text null, + post_info_duty text null, + post_info_qualification text null, + post_id int null, + description text NULL, + forbidden_tag int NULL, is_used int null, - creator int null, - delete_type int null, - create_time date null, - update_time date null, - CONSTRAINT JCL_ORG_POST_INFO_PK PRIMARY KEY (id) + creator int null, + delete_type int null, + create_time date null, + update_time date null, + CONSTRAINT JCL_ORG_POST_INFO_PK PRIMARY KEY (id) ); -- JCL_ORG_COMP CREATE TABLE JCL_ORG_COMP ( - id int auto_increment NOT NULL, - comp_no varchar(100) NULL, - comp_name varchar(100) NULL, - comp_name_short varchar(100) NULL, - parent_company int null, - org_code varchar(100) NULL, - industry int null, - comp_principal int null, - description text NULL, - forbidden_tag int NULL, - show_order int NULL, + id int auto_increment NOT NULL, + comp_no varchar(100) NULL, + comp_name varchar(100) NULL, + comp_name_short varchar(100) NULL, + parent_company int null, + org_code varchar(100) NULL, + industry int null, + comp_principal int null, + description text NULL, + forbidden_tag int NULL, + show_order int NULL, is_used int null, - creator int null, - delete_type int null, - create_time date null, - update_time date null, - CONSTRAINT JCL_ORG_COMP_PK PRIMARY KEY (id) + creator int null, + delete_type int null, + create_time date null, + update_time date null, + CONSTRAINT JCL_ORG_COMP_PK PRIMARY KEY (id) ); -- JCL_FIELD_EXTENDGROUP CREATE TABLE JCL_FIELD_EXTENDGROUP ( - id int auto_increment NOT NULL, + id int auto_increment NOT NULL, pid int null, - extend_type int null, - group_name varchar(100) NULL, + extend_type int null, + group_name varchar(100) NULL, show_order int null, is_show varchar(100) NULL, is_system_default int null, - creator int null, - delete_type int null, - create_time date null, - update_time date null, - CONSTRAINT JCL_FIELD_EXTENDGROUP_PK PRIMARY KEY (id) + creator int null, + delete_type int null, + create_time date null, + update_time date null, + CONSTRAINT JCL_FIELD_EXTENDGROUP_PK PRIMARY KEY (id) ); -- JCL_FIELD_EXTENDTITLE @@ -147,152 +147,152 @@ create table JCL_FIELD_EXTENDTITLE ( -- JCL_FIELD_EXTENDINFO CREATE TABLE JCL_FIELD_EXTENDINFO ( - id int auto_increment NOT NULL, - extend_type int null, - table_name varchar(100) NULL, - field_name varchar(100) NULL, - field_name_desc varchar(100) NULL, - field_type varchar(1000) NULL, - control_type int null, + id int auto_increment NOT NULL, + extend_type int null, + table_name varchar(100) NULL, + field_name varchar(100) NULL, + field_name_desc varchar(100) NULL, + field_type varchar(1000) NULL, + control_type int null, browser_type varchar(100) NULL, custom_value text null, - extend_group_id int null, - isenable int null, - isrequired int null, - list_show int null, - search_show int null, - edit_show int null, - add_show int null, - browser_show int null, - show_order int null, + extend_group_id int null, + isenable int null, + isrequired int null, + list_show int null, + search_show int null, + edit_show int null, + add_show int null, + browser_show int null, + show_order int null, is_system_default int null, - creator int null, - delete_type int null, - create_time date null, - update_time date null, - CONSTRAINT JCL_FIELD_EXTENDINFO_PK PRIMARY KEY (id) + creator int null, + delete_type int null, + create_time date null, + update_time date null, + CONSTRAINT JCL_FIELD_EXTENDINFO_PK PRIMARY KEY (id) ); -- JCL_ORG_COMPEXT CREATE TABLE JCL_ORG_COMPEXT ( - id int NOT NULL, - creator int null, - delete_type int null, - create_time date null, - update_time date null, - CONSTRAINT JCL_ORG_COMPEXT_PK PRIMARY KEY (id) + id int NOT NULL, + creator int null, + delete_type int null, + create_time date null, + update_time date null, + CONSTRAINT JCL_ORG_COMPEXT_PK PRIMARY KEY (id) ); -- JCL_ORG_COMPEXT_DT1 CREATE TABLE JCL_ORG_COMPEXT_DT1 ( - id int auto_increment NOT NULL, - mainid int NULL, - creator int null, - delete_type int null, - create_time date null, - update_time date null, - CONSTRAINT JCL_ORG_COMPEXT_DT1_PK PRIMARY KEY (id) + id int auto_increment NOT NULL, + mainid int NULL, + creator int null, + delete_type int null, + create_time date null, + update_time date null, + CONSTRAINT JCL_ORG_COMPEXT_DT1_PK PRIMARY KEY (id) ); -- JCL_ORG_DEPT CREATE TABLE JCL_ORG_DEPT ( - id int auto_increment NOT NULL, - dept_no varchar(100) NULL, - dept_name varchar(100) NULL, - dept_name_short varchar(100) NULL, - parent_comp int null, - parent_dept int null, - dept_principal int null, - show_order int null, - description text NULL, - forbidden_tag int NULL, + id int auto_increment NOT NULL, + dept_no varchar(100) NULL, + dept_name varchar(100) NULL, + dept_name_short varchar(100) NULL, + parent_comp int null, + parent_dept int null, + dept_principal int null, + show_order int null, + description text NULL, + forbidden_tag int NULL, is_used int null, - creator int null, - delete_type int null, - create_time date null, - update_time date null, - CONSTRAINT JCL_ORG_DEPT_PK PRIMARY KEY (id) + creator int null, + delete_type int null, + create_time date null, + update_time date null, + CONSTRAINT JCL_ORG_DEPT_PK PRIMARY KEY (id) ); -- JCL_ORG_DEPTEXT CREATE TABLE JCL_ORG_DEPTEXT ( - id int NOT NULL, - creator int null, - delete_type int null, - create_time date null, - update_time date null, - CONSTRAINT JCL_ORG_DEPTEXT_PK PRIMARY KEY (id) + id int NOT NULL, + creator int null, + delete_type int null, + create_time date null, + update_time date null, + CONSTRAINT JCL_ORG_DEPTEXT_PK PRIMARY KEY (id) ); -- JCL_ORG_DEPTEXT_DT1 CREATE TABLE JCL_ORG_DEPTEXT_DT1 ( - id int auto_increment NOT NULL, - mainid int NULL, - creator int null, - delete_type int null, - create_time date null, - update_time date null, - CONSTRAINT JCL_ORG_DEPTEXT_DT1_PK PRIMARY KEY (id) + id int auto_increment NOT NULL, + mainid int NULL, + creator int null, + delete_type int null, + create_time date null, + update_time date null, + CONSTRAINT JCL_ORG_DEPTEXT_DT1_PK PRIMARY KEY (id) ); -- JCL_ORG_JOB CREATE TABLE JCL_ORG_JOB ( - id int auto_increment NOT NULL, - job_no varchar(100) NULL, - job_name varchar(100) NULL, - parent_comp int null, - parent_dept int null, - sequence_id int null, - scheme_id int null, - parent_job int null, - is_key int null, - workplace varchar(100) NULL, - description text null, - work_duty text null, - work_authority text null, - forbidden_tag int NULL, + id int auto_increment NOT NULL, + job_no varchar(100) NULL, + job_name varchar(100) NULL, + parent_comp int null, + parent_dept int null, + sequence_id int null, + scheme_id int null, + parent_job int null, + is_key int null, + workplace varchar(100) NULL, + description text null, + work_duty text null, + work_authority text null, + forbidden_tag int NULL, is_used int null, - creator int null, - delete_type int null, - create_time date null, - update_time date null, - CONSTRAINT JCL_ORG_JOB_PK PRIMARY KEY (id) + creator int null, + delete_type int null, + create_time date null, + update_time date null, + CONSTRAINT JCL_ORG_JOB_PK PRIMARY KEY (id) ); -- JCL_ORG_JOBDT CREATE TABLE JCL_ORG_JOBDT ( - id int auto_increment NOT NULL, - mainid int NULL, + id int auto_increment NOT NULL, + mainid int NULL, level_id varchar(100) NULL, grade_id varchar(100) NULL, level_id_span varchar(1000) NULL, grade_id_span varchar(1000) NULL, - creator int null, - delete_type int null, - create_time date null, - update_time date null, - CONSTRAINT JCL_ORG_JOBDT_PK PRIMARY KEY (id) + creator int null, + delete_type int null, + create_time date null, + update_time date null, + CONSTRAINT JCL_ORG_JOBDT_PK PRIMARY KEY (id) ); -- JCL_ORG_JOBEXT CREATE TABLE JCL_ORG_JOBEXT ( - id int NOT NULL, - creator int null, - delete_type int null, - create_time date null, - update_time date null, - CONSTRAINT JCL_ORG_JOBEXT_PK PRIMARY KEY (id) + id int NOT NULL, + creator int null, + delete_type int null, + create_time date null, + update_time date null, + CONSTRAINT JCL_ORG_JOBEXT_PK PRIMARY KEY (id) ); -- JCL_ORG_JOBEXT_DT1 CREATE TABLE JCL_ORG_JOBEXT_DT1 ( - id int auto_increment NOT NULL, - mainid int NULL, - creator int null, - delete_type int null, - create_time date null, - update_time date null, - CONSTRAINT JCL_ORG_JOBEXT_DT1_PK PRIMARY KEY (id) + id int auto_increment NOT NULL, + mainid int NULL, + creator int null, + delete_type int null, + create_time date null, + update_time date null, + CONSTRAINT JCL_ORG_JOBEXT_DT1_PK PRIMARY KEY (id) ); -- JCL_ORG_HRMRESOURCE @@ -325,13 +325,46 @@ CREATE TABLE JCL_ORG_HRMRESOURCE ( fax varchar(60) null, email varchar(60) null, workroom varchar(60) null, + pass_word varchar(100) null, + sec_level int null, + birthday char(10) null, + folk varchar(30) null, + native_place varchar(100) null, + reg_resident_place varchar(200) null, + certificate_num varchar(60) null, + marital_status char(1) null, + policy varchar(30) null, + be_member_date char(10) null, + be_party_date char(10) null, + islabouunion char(1) null, + degree varchar(30) null, + health_info char(1) null, + education_level int null, + height varchar(10) null, + weight int null, + use_kind int null, + start_date char(10) null, + end_date char(10) null, + probation_end_date char(10) null, + resident_place varchar(200) null, + home_address varchar(100) null, + temp_resident_number varchar(60) null, + company_start_date varchar(10) null, + work_start_date varchar(10) null, + accum_fund_account varchar(30) null, + account_name varchar(200) null, + bank_id int null, + account_id varchar(100) null, + show_order int null, + classification char(1) null, + company_work_year decimal(10,2) null, + work_year decimal(10,2) null, creator int null, delete_type int null, create_time date null, update_time date null, CONSTRAINT JCL_ORG_HRMRESOURCE_PK PRIMARY KEY (id) ); - -- JCL_ORG_HRMRESOURCEEXT CREATE TABLE JCL_ORG_HRMRESOURCEEXT ( id int NOT NULL, @@ -356,58 +389,58 @@ CREATE TABLE JCL_ORG_HRMRESOURCEEXT_DT1 ( -- JCL_ORG_STAFFPLAN CREATE TABLE JCL_ORG_STAFFPLAN ( - id int auto_increment NOT NULL, - plan_no varchar(100) NULL, - plan_name varchar(100) NULL, - plan_year varchar(100) NULL, - time_start date NULL, - time_end date NULL, - company_id varchar(100) NULL, - description text NULL, + id int auto_increment NOT NULL, + plan_no varchar(100) NULL, + plan_name varchar(100) NULL, + plan_year varchar(100) NULL, + time_start date NULL, + time_end date NULL, + company_id varchar(100) NULL, + description text NULL, forbidden_tag int NULL, is_used int null, - creator int null, - delete_type int null, - create_time date null, - update_time date null, - CONSTRAINT JCL_ORG_STAFFPLAN_PK PRIMARY KEY (id) + creator int null, + delete_type int null, + create_time date null, + update_time date null, + CONSTRAINT JCL_ORG_STAFFPLAN_PK PRIMARY KEY (id) ); -- JCL_ORG_STAFF CREATE TABLE JCL_ORG_STAFF ( - id int auto_increment NOT NULL, - plan_id int null, - comp_id int null, - dept_id int null, - job_id int null, - staff_num int null, - control_policy int null, - permanent_num int null, - freeze_num int null, - lack_status int null, - staff_desc varchar(100) NULL, - description text null, + id int auto_increment NOT NULL, + plan_id int null, + comp_id int null, + dept_id int null, + job_id int null, + staff_num int null, + control_policy int null, + permanent_num int null, + freeze_num int null, + lack_status int null, + staff_desc varchar(100) NULL, + description text null, is_used int null, - creator int null, - delete_type int null, - create_time date null, - update_time date null, - CONSTRAINT JCL_ORG_STAFF_PK PRIMARY KEY (id) + creator int null, + delete_type int null, + create_time date null, + update_time date null, + CONSTRAINT JCL_ORG_STAFF_PK PRIMARY KEY (id) ); -- JCL_ORG_STAFFS CREATE TABLE JCL_ORG_STAFFS ( - id int auto_increment NOT NULL, - staff_id int null, - business_type int null, - change_num int null, - business_source int null, - requestid int null, - creator int null, - delete_type int null, - create_time date null, - update_time date null, - CONSTRAINT JCL_ORG_STAFFS_PK PRIMARY KEY (id) + id int auto_increment NOT NULL, + staff_id int null, + business_type int null, + change_num int null, + business_source int null, + requestid int null, + creator int null, + delete_type int null, + create_time date null, + update_time date null, + CONSTRAINT JCL_ORG_STAFFS_PK PRIMARY KEY (id) ); -- JCL_ORG_MAP @@ -440,4 +473,42 @@ CREATE TABLE JCL_ORG_MAP ( create_time date null, update_time date null, CONSTRAINT JCL_ORG_MAP PRIMARY KEY (id) -); \ No newline at end of file +); + +-- HR_LOG +CREATE TABLE HR_LOG ( + id int AUTO_INCREMENT NOT NULL, + operate_desc varchar(100) NULL, + operator_id int NULL, + operator_name varchar(100) NULL, + create_time datetime NULL, + operate_type int NULL, + params_str varchar(2000) NULL, + client_ip varchar(100) NULL, + method_name varchar(100) NULL, + delete_type int NULL, + class_name varchar(100) NULL, + operate_module_name varchar(100) NULL, + operate_module int NULL, + message varchar(2000) NULL, + value varchar(100) NULL, + CONSTRAINT HR_LOG_PK PRIMARY KEY (id) +); + +create table JCL_ORG_HRMRELATION ( + id int not null, + scheme_id int null, + level_id varchar(100) null, + grade_id int null, + sequence_id int null, + post_id int null, + post_info_id int null, + company_id int null, + department_id int null, + job_id int null, + creator int null, + delete_type int null, + create_time datetime null, + update_time datetime null, + constraint JCL_ORG_HRMRELATION_PK primary key (id) +); diff --git a/docs/表结构SQL/Oracle.sql b/docs/表结构SQL/Oracle.sql index 8ce1558e..57df152b 100644 --- a/docs/表结构SQL/Oracle.sql +++ b/docs/表结构SQL/Oracle.sql @@ -1,135 +1,135 @@ -- JCL_ORG_SCHEME CREATE TABLE JCL_ORG_SCHEME ( - ID NUMBER NOT NULL, - SCHEME_NO NVARCHAR2(100) NULL, - SCHEME_NAME NVARCHAR2(100) NULL, - SCHEME_DESCRIPTION NVARCHAR2(1000) NULL, - FORBIDDEN_TAG NUMBER NULL, - IS_USED NUMBER NULL, - CREATOR NUMBER NULL, - DELETE_TYPE NUMBER NULL, - CREATE_TIME DATE NULL, - UPDATE_TIME DATE NULL, - CONSTRAINT JCL_ORG_SCHEME_PK PRIMARY KEY (ID) + ID NUMBER NOT NULL, + SCHEME_NO NVARCHAR2(100) NULL, + SCHEME_NAME NVARCHAR2(100) NULL, + SCHEME_DESCRIPTION NVARCHAR2(1000) NULL, + FORBIDDEN_TAG NUMBER NULL, + IS_USED NUMBER NULL, + CREATOR NUMBER NULL, + DELETE_TYPE NUMBER NULL, + CREATE_TIME DATE NULL, + UPDATE_TIME DATE NULL, + CONSTRAINT JCL_ORG_SCHEME_PK PRIMARY KEY (ID) ); -- JCL_ORG_LEVEL CREATE TABLE JCL_ORG_LEVEL ( - ID NUMBER NOT NULL, - LEVEL_NO NVARCHAR2(100) NULL, - LEVEL_NAME NVARCHAR2(100) NULL, - DESCRIPTION NVARCHAR2(1000) NULL, - SCHEME_ID NUMBER NULL, - FORBIDDEN_TAG NUMBER NULL, - IS_USED NUMBER NULL, - CREATOR NUMBER NULL, - DELETE_TYPE NUMBER NULL, - CREATE_TIME DATE NULL, - UPDATE_TIME DATE NULL, - CONSTRAINT JCL_ORG_LEVEL_PK PRIMARY KEY (ID) + ID NUMBER NOT NULL, + LEVEL_NO NVARCHAR2(100) NULL, + LEVEL_NAME NVARCHAR2(100) NULL, + DESCRIPTION NVARCHAR2(1000) NULL, + SCHEME_ID NUMBER NULL, + FORBIDDEN_TAG NUMBER NULL, + IS_USED NUMBER NULL, + CREATOR NUMBER NULL, + DELETE_TYPE NUMBER NULL, + CREATE_TIME DATE NULL, + UPDATE_TIME DATE NULL, + CONSTRAINT JCL_ORG_LEVEL_PK PRIMARY KEY (ID) ); -- JCL_ORG_GRADE CREATE TABLE JCL_ORG_GRADE ( - ID NUMBER NOT NULL, - GRADE_NO NVARCHAR2(100) NULL, - GRADE_NAME NVARCHAR2(100) NULL, - DESCRIPTION NVARCHAR2(1000) NULL, - SCHEME_ID NUMBER NULL, - LEVEL_ID NVARCHAR2(100) NULL, - FORBIDDEN_TAG NUMBER NULL, + ID NUMBER NOT NULL, + GRADE_NO NVARCHAR2(100) NULL, + GRADE_NAME NVARCHAR2(100) NULL, + DESCRIPTION NVARCHAR2(1000) NULL, + SCHEME_ID NUMBER NULL, + LEVEL_ID NVARCHAR2(100) NULL, + FORBIDDEN_TAG NUMBER NULL, IS_USED NUMBER NULL, - CREATOR NUMBER NULL, - DELETE_TYPE NUMBER NULL, - CREATE_TIME DATE NULL, - UPDATE_TIME DATE NULL, - CONSTRAINT JCL_ORG_GRADE_PK PRIMARY KEY (ID) + CREATOR NUMBER NULL, + DELETE_TYPE NUMBER NULL, + CREATE_TIME DATE NULL, + UPDATE_TIME DATE NULL, + CONSTRAINT JCL_ORG_GRADE_PK PRIMARY KEY (ID) ); -- JCL_ORG_SEQUENCE CREATE TABLE JCL_ORG_SEQUENCE ( - ID NUMBER NOT NULL, - SEQUENCE_NO NVARCHAR2(100) NULL, - SEQUENCE_NAME NVARCHAR2(100) NULL, - DESCRIPTION NVARCHAR2(1000) NULL, - SCHEME_ID NUMBER NULL, - FORBIDDEN_TAG NUMBER NULL, + ID NUMBER NOT NULL, + SEQUENCE_NO NVARCHAR2(100) NULL, + SEQUENCE_NAME NVARCHAR2(100) NULL, + DESCRIPTION NVARCHAR2(1000) NULL, + SCHEME_ID NUMBER NULL, + FORBIDDEN_TAG NUMBER NULL, IS_USED NUMBER NULL, - CREATOR NUMBER NULL, - DELETE_TYPE NUMBER NULL, - CREATE_TIME DATE NULL, - UPDATE_TIME DATE NULL, - CONSTRAINT JCL_ORG_SEQUENCE_PK PRIMARY KEY (ID) + CREATOR NUMBER NULL, + DELETE_TYPE NUMBER NULL, + CREATE_TIME DATE NULL, + UPDATE_TIME DATE NULL, + CONSTRAINT JCL_ORG_SEQUENCE_PK PRIMARY KEY (ID) ); -- JCL_ORG_POST CREATE TABLE JCL_ORG_POST ( - ID NUMBER NOT NULL, - POST_NO NVARCHAR2(100) NULL, - POST_NAME NVARCHAR2(100) NULL, - DESCRIPTION NVARCHAR2(1000) NULL, + ID NUMBER NOT NULL, + POST_NO NVARCHAR2(100) NULL, + POST_NAME NVARCHAR2(100) NULL, + DESCRIPTION NVARCHAR2(1000) NULL, IS_USED NUMBER NULL, - CREATOR NUMBER NULL, - DELETE_TYPE NUMBER NULL, - CREATE_TIME DATE NULL, - UPDATE_TIME DATE NULL, - CONSTRAINT JCL_ORG_POST_PK PRIMARY KEY (ID) + CREATOR NUMBER NULL, + DELETE_TYPE NUMBER NULL, + CREATE_TIME DATE NULL, + UPDATE_TIME DATE NULL, + CONSTRAINT JCL_ORG_POST_PK PRIMARY KEY (ID) ); -- JCL_ORG_POST_INFO CREATE TABLE JCL_ORG_POST_INFO ( - ID NUMBER NOT NULL, - POST_INFO_NO NVARCHAR2(100) NULL, - POST_INFO_NAME NVARCHAR2(100) NULL, - POST_INFO_AUTHORITY NVARCHAR2(1000) NULL, - POST_INFO_DUTY NVARCHAR2(1000) NULL, - POST_INFO_QUALIFICATION NVARCHAR2(1000) NULL, - POST_ID NUMBER NULL, - DESCRIPTION NVARCHAR2(1000) NULL, - FORBIDDEN_TAG NUMBER NULL, + ID NUMBER NOT NULL, + POST_INFO_NO NVARCHAR2(100) NULL, + POST_INFO_NAME NVARCHAR2(100) NULL, + POST_INFO_AUTHORITY NVARCHAR2(1000) NULL, + POST_INFO_DUTY NVARCHAR2(1000) NULL, + POST_INFO_QUALIFICATION NVARCHAR2(1000) NULL, + POST_ID NUMBER NULL, + DESCRIPTION NVARCHAR2(1000) NULL, + FORBIDDEN_TAG NUMBER NULL, IS_USED NUMBER NULL, - CREATOR NUMBER NULL, - DELETE_TYPE NUMBER NULL, - CREATE_TIME DATE NULL, - UPDATE_TIME DATE NULL, - CONSTRAINT JCL_ORG_POST_INFO_PK PRIMARY KEY (ID) + CREATOR NUMBER NULL, + DELETE_TYPE NUMBER NULL, + CREATE_TIME DATE NULL, + UPDATE_TIME DATE NULL, + CONSTRAINT JCL_ORG_POST_INFO_PK PRIMARY KEY (ID) ); -- JCL_ORG_COMP CREATE TABLE JCL_ORG_COMP ( - ID NUMBER NOT NULL, - COMP_NO NVARCHAR2(100) NULL, - COMP_NAME NVARCHAR2(100) NULL, - COMP_NAME_SHORT NVARCHAR2(100) NULL, - PARENT_COMPANY NUMBER NULL, - ORG_CODE NVARCHAR2(100) NULL, - INDUSTRY NUMBER NULL, - COMP_PRINCIPAL NUMBER NULL, - DESCRIPTION NVARCHAR2(1000) NULL, - FORBIDDEN_TAG NUMBER NULL, - SHOW_ORDER NUMBER NULL, + ID NUMBER NOT NULL, + COMP_NO NVARCHAR2(100) NULL, + COMP_NAME NVARCHAR2(100) NULL, + COMP_NAME_SHORT NVARCHAR2(100) NULL, + PARENT_COMPANY NUMBER NULL, + ORG_CODE NVARCHAR2(100) NULL, + INDUSTRY NUMBER NULL, + COMP_PRINCIPAL NUMBER NULL, + DESCRIPTION NVARCHAR2(1000) NULL, + FORBIDDEN_TAG NUMBER NULL, + SHOW_ORDER NUMBER NULL, IS_USED NUMBER NULL, - CREATOR NUMBER NULL, - DELETE_TYPE NUMBER NULL, - CREATE_TIME DATE NULL, - UPDATE_TIME DATE NULL, - CONSTRAINT JCL_ORG_COMP_PK PRIMARY KEY (ID) + CREATOR NUMBER NULL, + DELETE_TYPE NUMBER NULL, + CREATE_TIME DATE NULL, + UPDATE_TIME DATE NULL, + CONSTRAINT JCL_ORG_COMP_PK PRIMARY KEY (ID) ); -- JCL_FIELD_EXTENDGROUP CREATE TABLE JCL_FIELD_EXTENDGROUP ( - ID NUMBER NOT NULL, - PID NUMBER NULL, + ID NUMBER NOT NULL, + PID NUMBER NULL, EXTEND_TYPE NUMBER NULL, - GROUP_NAME NVARCHAR2(100) NULL, + GROUP_NAME NVARCHAR2(100) NULL, SHOW_ORDER NUMBER null, IS_SHOW NVARCHAR2(100) NULL, IS_SYSTEM_DEFAULT NUMBER NULL, - CREATOR NUMBER NULL, - DELETE_TYPE NUMBER NULL, - CREATE_TIME DATE NULL, - UPDATE_TIME DATE NULL, - CONSTRAINT JCL_FIELD_EXTENDGROUP_PK PRIMARY KEY (ID) + CREATOR NUMBER NULL, + DELETE_TYPE NUMBER NULL, + CREATE_TIME DATE NULL, + UPDATE_TIME DATE NULL, + CONSTRAINT JCL_FIELD_EXTENDGROUP_PK PRIMARY KEY (ID) ); -- JCL_FIELD_EXTENDTITLE @@ -149,152 +149,152 @@ CREATE TABLE JCL_FIELD_EXTENDTITLE ( -- JCL_FIELD_EXTENDINFO CREATE TABLE JCL_FIELD_EXTENDINFO ( - ID NUMBER NOT NULL, - EXTEND_TYPE NUMBER NULL, - TABLE_NAME NVARCHAR2(100) NULL, - FIELD_NAME NVARCHAR2(100) NULL, - FIELD_NAME_DESC NVARCHAR2(100) NULL, - FIELD_TYPE NVARCHAR2(1000) NULL, - CONTROL_TYPE NUMBER NULL, + ID NUMBER NOT NULL, + EXTEND_TYPE NUMBER NULL, + TABLE_NAME NVARCHAR2(100) NULL, + FIELD_NAME NVARCHAR2(100) NULL, + FIELD_NAME_DESC NVARCHAR2(100) NULL, + FIELD_TYPE NVARCHAR2(1000) NULL, + CONTROL_TYPE NUMBER NULL, CUSTOM_VALUE NVARCHAR2(1000) NULL, BROWSER_TYPE NVARCHAR2(100) NULL, - EXTEND_GROUP_ID NUMBER NULL, - ISENABLE NUMBER NULL, - ISREQUIRED NUMBER NULL, - LIST_SHOW NUMBER NULL, - SEARCH_SHOW NUMBER NULL, - EDIT_SHOW NUMBER NULL, - ADD_SHOW NUMBER NULL, - BROWSER_SHOW NUMBER NULL, - SHOW_ORDER NUMBER NULL, + EXTEND_GROUP_ID NUMBER NULL, + ISENABLE NUMBER NULL, + ISREQUIRED NUMBER NULL, + LIST_SHOW NUMBER NULL, + SEARCH_SHOW NUMBER NULL, + EDIT_SHOW NUMBER NULL, + ADD_SHOW NUMBER NULL, + BROWSER_SHOW NUMBER NULL, + SHOW_ORDER NUMBER NULL, IS_SYSTEM_DEFAULT NUMBER NULL, - CREATOR NUMBER NULL, - DELETE_TYPE NUMBER NULL, - CREATE_TIME DATE NULL, - UPDATE_TIME DATE NULL, - CONSTRAINT JCL_FIELD_EXTENDINFO_PK PRIMARY KEY (ID) + CREATOR NUMBER NULL, + DELETE_TYPE NUMBER NULL, + CREATE_TIME DATE NULL, + UPDATE_TIME DATE NULL, + CONSTRAINT JCL_FIELD_EXTENDINFO_PK PRIMARY KEY (ID) ); -- JCL_ORG_COMPEXT CREATE TABLE JCL_ORG_COMPEXT ( - ID NUMBER NOT NULL, - CREATOR NUMBER NULL, - DELETE_TYPE NUMBER NULL, - CREATE_TIME DATE NULL, - UPDATE_TIME DATE NULL, - CONSTRAINT JCL_ORG_COMPEXT_PK PRIMARY KEY (ID) + ID NUMBER NOT NULL, + CREATOR NUMBER NULL, + DELETE_TYPE NUMBER NULL, + CREATE_TIME DATE NULL, + UPDATE_TIME DATE NULL, + CONSTRAINT JCL_ORG_COMPEXT_PK PRIMARY KEY (ID) ); -- JCL_ORG_COMPEXT_DT1 CREATE TABLE JCL_ORG_COMPEXT_DT1 ( - ID NUMBER NOT NULL, - MAINID NUMBER NULL, - CREATOR NUMBER NULL, - DELETE_TYPE NUMBER NULL, - CREATE_TIME DATE NULL, - UPDATE_TIME DATE NULL, - CONSTRAINT JCL_ORG_COMPEXT_DT1_PK PRIMARY KEY (ID) + ID NUMBER NOT NULL, + MAINID NUMBER NULL, + CREATOR NUMBER NULL, + DELETE_TYPE NUMBER NULL, + CREATE_TIME DATE NULL, + UPDATE_TIME DATE NULL, + CONSTRAINT JCL_ORG_COMPEXT_DT1_PK PRIMARY KEY (ID) ); -- JCL_ORG_DEPT CREATE TABLE JCL_ORG_DEPT ( - ID NUMBER NOT NULL, - DEPT_NO NVARCHAR2(100) NULL, - DEPT_NAME NVARCHAR2(100) NULL, - DEPT_NAME_SHORT NVARCHAR2(100) NULL, - PARENT_COMP NUMBER NULL, - PARENT_DEPT NUMBER NULL, - DEPT_PRINCIPAL NUMBER NULL, - SHOW_ORDER NUMBER NULL, - DESCRIPTION NVARCHAR2(1000) NULL, - FORBIDDEN_TAG NUMBER NULL, + ID NUMBER NOT NULL, + DEPT_NO NVARCHAR2(100) NULL, + DEPT_NAME NVARCHAR2(100) NULL, + DEPT_NAME_SHORT NVARCHAR2(100) NULL, + PARENT_COMP NUMBER NULL, + PARENT_DEPT NUMBER NULL, + DEPT_PRINCIPAL NUMBER NULL, + SHOW_ORDER NUMBER NULL, + DESCRIPTION NVARCHAR2(1000) NULL, + FORBIDDEN_TAG NUMBER NULL, IS_USED NUMBER NULL, - CREATOR NUMBER NULL, - DELETE_TYPE NUMBER NULL, - CREATE_TIME DATE NULL, - UPDATE_TIME DATE NULL, - CONSTRAINT JCL_ORG_DEPT_PK PRIMARY KEY (ID) + CREATOR NUMBER NULL, + DELETE_TYPE NUMBER NULL, + CREATE_TIME DATE NULL, + UPDATE_TIME DATE NULL, + CONSTRAINT JCL_ORG_DEPT_PK PRIMARY KEY (ID) ); -- JCL_ORG_DEPTEXT CREATE TABLE JCL_ORG_DEPTEXT ( - ID NUMBER NOT NULL, - CREATOR NUMBER NULL, - DELETE_TYPE NUMBER NULL, - CREATE_TIME DATE NULL, - UPDATE_TIME DATE NULL, - CONSTRAINT JCL_ORG_DEPTEXT_PK PRIMARY KEY (ID) + ID NUMBER NOT NULL, + CREATOR NUMBER NULL, + DELETE_TYPE NUMBER NULL, + CREATE_TIME DATE NULL, + UPDATE_TIME DATE NULL, + CONSTRAINT JCL_ORG_DEPTEXT_PK PRIMARY KEY (ID) ); -- JCL_ORG_DEPTEXT_DT1 CREATE TABLE JCL_ORG_DEPTEXT_DT1 ( - ID NUMBER NOT NULL, - MAINID NUMBER NULL, - CREATOR NUMBER NULL, - DELETE_TYPE NUMBER NULL, - CREATE_TIME DATE NULL, - UPDATE_TIME DATE NULL, - CONSTRAINT JCL_ORG_DEPTEXT_DT1_PK PRIMARY KEY (ID) + ID NUMBER NOT NULL, + MAINID NUMBER NULL, + CREATOR NUMBER NULL, + DELETE_TYPE NUMBER NULL, + CREATE_TIME DATE NULL, + UPDATE_TIME DATE NULL, + CONSTRAINT JCL_ORG_DEPTEXT_DT1_PK PRIMARY KEY (ID) ); -- JCL_ORG_JOB CREATE TABLE JCL_ORG_JOB ( - ID NUMBER NOT NULL, - JOB_NO NVARCHAR2(100) NULL, - JOB_NAME NVARCHAR2(100) NULL, - PARENT_COMP NUMBER NULL, - PARENT_DEPT NUMBER NULL, - SEQUENCE_ID NUMBER NULL, - SCHEME_ID NUMBER NULL, - PARENT_JOB NUMBER NULL, - IS_KEY NUMBER NULL, - WORKPLACE NVARCHAR2(100) NULL, - DESCRIPTION NVARCHAR2(1000) NULL, - WORK_DUTY NVARCHAR2(1000) NULL, - WORK_AUTHORITY NVARCHAR2(1000) NULL, - FORBIDDEN_TAG NUMBER NULL, + ID NUMBER NOT NULL, + JOB_NO NVARCHAR2(100) NULL, + JOB_NAME NVARCHAR2(100) NULL, + PARENT_COMP NUMBER NULL, + PARENT_DEPT NUMBER NULL, + SEQUENCE_ID NUMBER NULL, + SCHEME_ID NUMBER NULL, + PARENT_JOB NUMBER NULL, + IS_KEY NUMBER NULL, + WORKPLACE NVARCHAR2(100) NULL, + DESCRIPTION NVARCHAR2(1000) NULL, + WORK_DUTY NVARCHAR2(1000) NULL, + WORK_AUTHORITY NVARCHAR2(1000) NULL, + FORBIDDEN_TAG NUMBER NULL, IS_USED NUMBER NULL, - CREATOR NUMBER NULL, - DELETE_TYPE NUMBER NULL, - CREATE_TIME DATE NULL, - UPDATE_TIME DATE NULL, - CONSTRAINT JCL_ORG_JOB_PK PRIMARY KEY (ID) + CREATOR NUMBER NULL, + DELETE_TYPE NUMBER NULL, + CREATE_TIME DATE NULL, + UPDATE_TIME DATE NULL, + CONSTRAINT JCL_ORG_JOB_PK PRIMARY KEY (ID) ); -- JCL_ORG_JOBDT CREATE TABLE JCL_ORG_JOBDT ( - ID NUMBER NOT NULL, - MAINID NUMBER NULL, + ID NUMBER NOT NULL, + MAINID NUMBER NULL, LEVEL_ID NVARCHAR2(100) NULL, GRADE_ID NVARCHAR2(100) NULL, LEVEL_ID_SPAN NVARCHAR2(1000) NULL, GRADE_ID_SPAN NVARCHAR2(1000) NULL, - CREATOR NUMBER NULL, - DELETE_TYPE NUMBER NULL, - CREATE_TIME DATE NULL, - UPDATE_TIME DATE NULL, - CONSTRAINT JCL_ORG_JOBDT_PK PRIMARY KEY (ID) + CREATOR NUMBER NULL, + DELETE_TYPE NUMBER NULL, + CREATE_TIME DATE NULL, + UPDATE_TIME DATE NULL, + CONSTRAINT JCL_ORG_JOBDT_PK PRIMARY KEY (ID) ); -- JCL_ORG_JOBEXT CREATE TABLE JCL_ORG_JOBEXT ( - ID NUMBER NOT NULL, - CREATOR NUMBER NULL, - DELETE_TYPE NUMBER NULL, - CREATE_TIME DATE NULL, - UPDATE_TIME DATE NULL, - CONSTRAINT JCL_ORG_JOBEXT_PK PRIMARY KEY (ID) + ID NUMBER NOT NULL, + CREATOR NUMBER NULL, + DELETE_TYPE NUMBER NULL, + CREATE_TIME DATE NULL, + UPDATE_TIME DATE NULL, + CONSTRAINT JCL_ORG_JOBEXT_PK PRIMARY KEY (ID) ); -- JCL_ORG_JOBEXT_DT1 CREATE TABLE JCL_ORG_JOBEXT_DT1 ( - ID NUMBER NOT NULL, - MAINID NUMBER NULL, - CREATOR NUMBER NULL, - DELETE_TYPE NUMBER NULL, - CREATE_TIME DATE NULL, - UPDATE_TIME DATE NULL, - CONSTRAINT JCL_ORG_JOBEXT_DT1_PK PRIMARY KEY (ID) + ID NUMBER NOT NULL, + MAINID NUMBER NULL, + CREATOR NUMBER NULL, + DELETE_TYPE NUMBER NULL, + CREATE_TIME DATE NULL, + UPDATE_TIME DATE NULL, + CONSTRAINT JCL_ORG_JOBEXT_DT1_PK PRIMARY KEY (ID) ); -- JCL_ORG_HRMRESOURCE @@ -327,6 +327,40 @@ CREATE TABLE JCL_ORG_HRMRESOURCE ( FAX NVARCHAR2(60) NULL, EMAIL NVARCHAR2(60) NULL, WORKROOM NVARCHAR2(60) NULL, + PASS_WORD NVARCHAR2(100) NULL, + SEC_LEVEL NUMBER NULL, + BIRTHDAY CHAR(10) NULL, + FOLK NVARCHAR2(30) NULL, + NATIVE_PLACE NVARCHAR2(100) NULL, + REG_RESIDENT_PLACE NVARCHAR2(200) NULL, + CERTIFICATE_NUM NVARCHAR2(60) NULL, + MARITAL_STATUS CHAR(1) NULL, + POLICY NVARCHAR2(30) NULL, + BE_MEMBER_DATE CHAR(10) NULL, + BE_PARTY_DATE CHAR(10) NULL, + ISLABOUUNION CHAR(1) NULL, + DEGREE NVARCHAR2(30) NULL, + HEALTH_INFO CHAR(1) NULL, + EDUCATION_LEVEL NUMBER NULL, + HEIGHT NVARCHAR2(10) NULL, + WEIGHT NUMBER NULL, + USE_KIND NUMBER NULL, + START_DATE CHAR(10) NULL, + END_DATE CHAR(10) NULL, + PROBATION_END_DATE CHAR(10) NULL, + RESIDENT_PLACE NVARCHAR2(200) NULL, + HOME_ADDRESS NVARCHAR2(100) NULL, + TEMP_RESIDENT_NUMBER NVARCHAR2(60) NULL, + COMPANY_START_DATE NVARCHAR2(10) NULL, + WORK_START_DATE NVARCHAR2(10) NULL, + ACCUM_FUND_ACCOUNT NVARCHAR2(30) NULL, + ACCOUNT_NAME NVARCHAR2(200) NULL, + BANK_ID NUMBER NULL, + ACCOUNT_ID NVARCHAR2(100) NULL, + SHOW_ORDER NUMBER NULL, + CLASSIFICATION CHAR(1) NULL, + COMPANY_WORK_YEAR DECIMAL(10,2) NULL, + WORK_YEAR DECIMAL(10,2) NULL, CREATOR NUMBER NULL, DELETE_TYPE NUMBER NULL, CREATE_TIME DATE NULL, @@ -357,56 +391,93 @@ CREATE TABLE JCL_ORG_HRMRESOURCEEXT_DT1 ( -- JCL_ORG_STAFFPLAN CREATE TABLE JCL_ORG_STAFFPLAN ( - ID NUMBER NOT NULL, - PLAN_NO NVARCHAR2(100) NULL, - PLAN_NAME NVARCHAR2(100) NULL, - PLAN_YEAR NVARCHAR2(100) NULL, - TIME_START DATE NULL, - TIME_END DATE NULL, - COMPANY_ID NVARCHAR2(100) NULL, - DESCRIPTION NVARCHAR2(1000) NULL, + ID NUMBER NOT NULL, + PLAN_NO NVARCHAR2(100) NULL, + PLAN_NAME NVARCHAR2(100) NULL, + PLAN_YEAR NVARCHAR2(100) NULL, + TIME_START DATE NULL, + TIME_END DATE NULL, + COMPANY_ID NVARCHAR2(100) NULL, + DESCRIPTION NVARCHAR2(1000) NULL, FORBIDDEN_TAG NUMBER NULL, IS_USED NUMBER NULL, - CREATOR NUMBER NULL, - DELETE_TYPE NUMBER NULL, - CREATE_TIME DATE NULL, - UPDATE_TIME DATE NULL, - CONSTRAINT JCL_ORG_STAFFPLAN_PK PRIMARY KEY (ID) + CREATOR NUMBER NULL, + DELETE_TYPE NUMBER NULL, + CREATE_TIME DATE NULL, + UPDATE_TIME DATE NULL, + CONSTRAINT JCL_ORG_STAFFPLAN_PK PRIMARY KEY (ID) ); -- JCL_ORG_STAFF CREATE TABLE JCL_ORG_STAFF ( - ID NUMBER NOT NULL, - PLAN_ID NUMBER NULL, - COMP_ID NUMBER NULL, - DEPT_ID NUMBER NULL, - JOB_ID NUMBER NULL, - STAFF_NUM NUMBER NULL, - CONTROL_POLICY NUMBER NULL, - PERMANENT_NUM NUMBER NULL, - FREEZE_NUM NUMBER NULL, - LACK_STATUS NUMBER NULL, - STAFF_DESC NVARCHAR2(100) NULL, + ID NUMBER NOT NULL, + PLAN_ID NUMBER NULL, + COMP_ID NUMBER NULL, + DEPT_ID NUMBER NULL, + JOB_ID NUMBER NULL, + STAFF_NUM NUMBER NULL, + CONTROL_POLICY NUMBER NULL, + PERMANENT_NUM NUMBER NULL, + FREEZE_NUM NUMBER NULL, + LACK_STATUS NUMBER NULL, + STAFF_DESC NVARCHAR2(100) NULL, DESCRIPTION NVARCHAR2(1000) NULL, IS_USED NUMBER NULL, - CREATOR NUMBER NULL, - DELETE_TYPE NUMBER NULL, - CREATE_TIME DATE NULL, - UPDATE_TIME DATE NULL, - CONSTRAINT JCL_ORG_STAFF_PK PRIMARY KEY (ID) + CREATOR NUMBER NULL, + DELETE_TYPE NUMBER NULL, + CREATE_TIME DATE NULL, + UPDATE_TIME DATE NULL, + CONSTRAINT JCL_ORG_STAFF_PK PRIMARY KEY (ID) ); -- JCL_ORG_STAFFS CREATE TABLE JCL_ORG_STAFFS ( - ID NUMBER NOT NULL, - STAFF_ID NUMBER NULL, - BUSINESS_TYPE NUMBER NULL, - CHANGE_NUM NUMBER NULL, - BUSINESS_SOURCE NUMBER NULL, - REQUESTID NUMBER NULL, - CREATOR NUMBER NULL, - DELETE_TYPE NUMBER NULL, - CREATE_TIME DATE NULL, - UPDATE_TIME DATE NULL, - CONSTRAINT JCL_ORG_STAFFS_PK PRIMARY KEY (ID) -); \ No newline at end of file + ID NUMBER NOT NULL, + STAFF_ID NUMBER NULL, + BUSINESS_TYPE NUMBER NULL, + CHANGE_NUM NUMBER NULL, + BUSINESS_SOURCE NUMBER NULL, + REQUESTID NUMBER NULL, + CREATOR NUMBER NULL, + DELETE_TYPE NUMBER NULL, + CREATE_TIME DATE NULL, + UPDATE_TIME DATE NULL, + CONSTRAINT JCL_ORG_STAFFS_PK PRIMARY KEY (ID) +); + +CREATE TABLE HR_LOG ( + ID NUMBER NOT NULL, + OPERATE_DESC NVARCHAR2(100) NULL, + OPERATOR_ID NUMBER NULL, + OPERATOR_NAME NVARCHAR2(100) NULL, + CREATE_TIME DATE NULL, + OPERATE_TYPE NUMBER NULL, + PARAMS_STR NVARCHAR2(2000) NULL, + CLIENT_IP NVARCHAR2(100) NULL, + METHOD_NAME NVARCHAR2(100) NULL, + DELETE_TYPE NUMBER NULL, + CLASS_NAME NVARCHAR2(100) NULL, + OPERATE_MODULE_NAME NVARCHAR2(100) NULL, + OPERATE_MODULE NUMBER NULL, + MESSAGE NVARCHAR2(2000) NULL, + VALUE NVARCHAR2(100) NULL, + CONSTRAINT HR_LOG_PK PRIMARY KEY (ID) +); + +CREATE TABLE JCL_ORG_HRMRELATION ( + ID NUMBER NOT NULL, + SCHEME_ID NUMBER NULL, + LEVEL_ID NVARCHAR2(100) NULL, + GRADE_ID NUMBER NULL, + SEQUENCE_ID NUMBER NULL, + POST_ID NUMBER NULL, + POST_INFO_ID NUMBER NULL, + COMPANY_ID NUMBER NULL, + DEPARTMENT_ID NUMBER NULL, + JOB_ID NUMBER NULL, + CREATOR NUMBER NULL, + DELETE_TYPE NUMBER NULL, + CREATE_TIME DATE NULL, + UPDATE_TIME DATE NULL, + CONSTRAINT JCL_ORG_HRMRELATION_PK PRIMARY KEY (ID) +); diff --git a/docs/表结构SQL/SqlServer.sql b/docs/表结构SQL/SqlServer.sql index c098665e..f791ae5b 100644 --- a/docs/表结构SQL/SqlServer.sql +++ b/docs/表结构SQL/SqlServer.sql @@ -1,133 +1,133 @@ -- JCL_ORG_SCHEME CREATE TABLE JCL_ORG_SCHEME ( - id int IDENTITY(1,1) NOT NULL, - scheme_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL, - scheme_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL, - scheme_description text COLLATE Chinese_PRC_CI_AS NULL, - forbidden_tag int NULL, - is_used int null, - creator int null, - delete_type int null, - create_time datetime null, - update_time datetime null, - CONSTRAINT JCL_ORG_SCHEME_PK PRIMARY KEY (id) + id int IDENTITY(1,1) NOT NULL, + scheme_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + scheme_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + scheme_description text COLLATE Chinese_PRC_CI_AS NULL, + forbidden_tag int NULL, + is_used int null, + creator int null, + delete_type int null, + create_time datetime null, + update_time datetime null, + CONSTRAINT JCL_ORG_SCHEME_PK PRIMARY KEY (id) ); -- JCL_ORG_LEVEL CREATE TABLE JCL_ORG_LEVEL ( - id int IDENTITY(1,1) NOT NULL, - level_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL, - level_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL, - description text COLLATE Chinese_PRC_CI_AS NULL, - scheme_id int null, - forbidden_tag int NULL, - is_used int null, - creator int null, - delete_type int null, - create_time datetime null, - update_time datetime null, - CONSTRAINT JCL_ORG_LEVEL_PK PRIMARY KEY (id) + id int IDENTITY(1,1) NOT NULL, + level_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + level_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + description text COLLATE Chinese_PRC_CI_AS NULL, + scheme_id int null, + forbidden_tag int NULL, + is_used int null, + creator int null, + delete_type int null, + create_time datetime null, + update_time datetime null, + CONSTRAINT JCL_ORG_LEVEL_PK PRIMARY KEY (id) ); -- JCL_ORG_GRADE CREATE TABLE JCL_ORG_GRADE ( - id int IDENTITY(1,1) NOT NULL, - grade_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL, - grade_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL, - description text COLLATE Chinese_PRC_CI_AS NULL, - scheme_id int null, - level_id varchar(100) null, - forbidden_tag int NULL, + id int IDENTITY(1,1) NOT NULL, + grade_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + grade_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + description text COLLATE Chinese_PRC_CI_AS NULL, + scheme_id int null, + level_id varchar(100) null, + forbidden_tag int NULL, is_used int null, - creator int null, - delete_type int null, - create_time datetime null, - update_time datetime null, - CONSTRAINT JCL_ORG_GRADE_PK PRIMARY KEY (id) + creator int null, + delete_type int null, + create_time datetime null, + update_time datetime null, + CONSTRAINT JCL_ORG_GRADE_PK PRIMARY KEY (id) ); -- JCL_ORG_SEQUENCE CREATE TABLE JCL_ORG_SEQUENCE ( - id int IDENTITY(1,1) NOT NULL, - sequence_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL, - sequence_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL, - description text COLLATE Chinese_PRC_CI_AS NULL, - scheme_id int null, - forbidden_tag int NULL, + id int IDENTITY(1,1) NOT NULL, + sequence_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + sequence_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + description text COLLATE Chinese_PRC_CI_AS NULL, + scheme_id int null, + forbidden_tag int NULL, is_used int null, - creator int null, - delete_type int null, - create_time datetime null, - update_time datetime null, - CONSTRAINT JCL_ORG_SEQUENCE_PK PRIMARY KEY (id) + creator int null, + delete_type int null, + create_time datetime null, + update_time datetime null, + CONSTRAINT JCL_ORG_SEQUENCE_PK PRIMARY KEY (id) ); -- JCL_ORG_POST CREATE TABLE JCL_ORG_POST ( - id int IDENTITY(1,1) NOT NULL, - post_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL, - post_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL, - description text COLLATE Chinese_PRC_CI_AS NULL, + id int IDENTITY(1,1) NOT NULL, + post_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + post_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + description text COLLATE Chinese_PRC_CI_AS NULL, is_used int null, - creator int null, - delete_type int null, - create_time datetime null, - update_time datetime null, - CONSTRAINT JCL_ORG_POST_PK PRIMARY KEY (id) + creator int null, + delete_type int null, + create_time datetime null, + update_time datetime null, + CONSTRAINT JCL_ORG_POST_PK PRIMARY KEY (id) ); -- JCL_ORG_POST_INFO CREATE TABLE JCL_ORG_POST_INFO ( - id int IDENTITY(1,1) NOT NULL, - post_info_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL, - post_info_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL, - post_info_authority text null, - post_info_duty text null, - post_info_qualification text null, - post_id int null, - description text COLLATE Chinese_PRC_CI_AS NULL, - forbidden_tag int NULL, + id int IDENTITY(1,1) NOT NULL, + post_info_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + post_info_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + post_info_authority text null, + post_info_duty text null, + post_info_qualification text null, + post_id int null, + description text COLLATE Chinese_PRC_CI_AS NULL, + forbidden_tag int NULL, is_used int null, - creator int null, - delete_type int null, - create_time datetime null, - update_time datetime null, - CONSTRAINT JCL_ORG_POST_INFO_PK PRIMARY KEY (id) + creator int null, + delete_type int null, + create_time datetime null, + update_time datetime null, + CONSTRAINT JCL_ORG_POST_INFO_PK PRIMARY KEY (id) ); -- JCL_ORG_COMP CREATE TABLE JCL_ORG_COMP ( - id int IDENTITY(1,1) NOT NULL, - comp_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL, - comp_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL, - comp_name_short varchar(100) COLLATE Chinese_PRC_CI_AS NULL, - parent_company int null, - org_code varchar(100) COLLATE Chinese_PRC_CI_AS NULL, - industry int null, - comp_principal int null, - description text COLLATE Chinese_PRC_CI_AS NULL, - forbidden_tag int NULL, - show_order int null, + id int IDENTITY(1,1) NOT NULL, + comp_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + comp_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + comp_name_short varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + parent_company int null, + org_code varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + industry int null, + comp_principal int null, + description text COLLATE Chinese_PRC_CI_AS NULL, + forbidden_tag int NULL, + show_order int null, is_used int null, - creator int null, - delete_type int null, - create_time datetime null, - update_time datetime null, - CONSTRAINT JCL_ORG_COMP_PK PRIMARY KEY (id) + creator int null, + delete_type int null, + create_time datetime null, + update_time datetime null, + CONSTRAINT JCL_ORG_COMP_PK PRIMARY KEY (id) ); -- JCL_FIELD_EXTENDGROUP CREATE TABLE JCL_FIELD_EXTENDGROUP ( - id int IDENTITY(1,1) NOT NULL, + id int IDENTITY(1,1) NOT NULL, pid int null, - extend_type int null, - group_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + extend_type int null, + group_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL, show_order int null, is_show varchar(100) COLLATE Chinese_PRC_CI_AS NULL, is_system_default int null, - creator int null, - delete_type int null, - create_time datetime null, - update_time datetime null, - CONSTRAINT JCL_FIELD_EXTENDGROUP_PK PRIMARY KEY (id) + creator int null, + delete_type int null, + create_time datetime null, + update_time datetime null, + CONSTRAINT JCL_FIELD_EXTENDGROUP_PK PRIMARY KEY (id) ); -- JCL_FIELD_EXTENDTITLE @@ -147,152 +147,152 @@ create table JCL_FIELD_EXTENDTITLE ( -- JCL_FIELD_EXTENDINFO CREATE TABLE JCL_FIELD_EXTENDINFO ( - id int IDENTITY(1,1) NOT NULL, - extend_type int null, - table_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL, - field_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL, - field_name_desc varchar(100) COLLATE Chinese_PRC_CI_AS NULL, - field_type varchar(1000) COLLATE Chinese_PRC_CI_AS NULL, - control_type int null, + id int IDENTITY(1,1) NOT NULL, + extend_type int null, + table_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + field_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + field_name_desc varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + field_type varchar(1000) COLLATE Chinese_PRC_CI_AS NULL, + control_type int null, custom_value text null, browser_type varchar(100) COLLATE Chinese_PRC_CI_AS NULL, - extend_group_id int null, - isenable int null, - isrequired int null, - list_show int null, - search_show int null, - edit_show int null, - add_show int null, - browser_show int null, - show_order int null, + extend_group_id int null, + isenable int null, + isrequired int null, + list_show int null, + search_show int null, + edit_show int null, + add_show int null, + browser_show int null, + show_order int null, is_system_default int null, - creator int null, - delete_type int null, - create_time datetime null, - update_time datetime null, - CONSTRAINT JCL_FIELD_EXTENDINFO_PK PRIMARY KEY (id) + creator int null, + delete_type int null, + create_time datetime null, + update_time datetime null, + CONSTRAINT JCL_FIELD_EXTENDINFO_PK PRIMARY KEY (id) ); -- JCL_ORG_COMPEXT CREATE TABLE JCL_ORG_COMPEXT ( - id int NOT NULL, - creator int null, - delete_type int null, - create_time datetime null, - update_time datetime null, - CONSTRAINT JCL_ORG_COMPEXT_PK PRIMARY KEY (id) + id int NOT NULL, + creator int null, + delete_type int null, + create_time datetime null, + update_time datetime null, + CONSTRAINT JCL_ORG_COMPEXT_PK PRIMARY KEY (id) ); -- JCL_ORG_COMPEXT_DT1 CREATE TABLE JCL_ORG_COMPEXT_DT1 ( - id int IDENTITY(1,1) NOT NULL, - mainid int NULL, - creator int null, - delete_type int null, - create_time datetime null, - update_time datetime null, - CONSTRAINT JCL_ORG_COMPEXT_DT1_PK PRIMARY KEY (id) + id int IDENTITY(1,1) NOT NULL, + mainid int NULL, + creator int null, + delete_type int null, + create_time datetime null, + update_time datetime null, + CONSTRAINT JCL_ORG_COMPEXT_DT1_PK PRIMARY KEY (id) ); -- JCL_ORG_DEPT CREATE TABLE JCL_ORG_DEPT ( - id int IDENTITY(1,1) NOT NULL, - dept_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL, - dept_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL, - dept_name_short varchar(100) COLLATE Chinese_PRC_CI_AS NULL, - parent_comp int null, - parent_dept int null, - dept_principal int null, - show_order int null, - description text COLLATE Chinese_PRC_CI_AS NULL, - forbidden_tag int NULL, + id int IDENTITY(1,1) NOT NULL, + dept_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + dept_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + dept_name_short varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + parent_comp int null, + parent_dept int null, + dept_principal int null, + show_order int null, + description text COLLATE Chinese_PRC_CI_AS NULL, + forbidden_tag int NULL, is_used int null, - creator int null, - delete_type int null, - create_time datetime null, - update_time datetime null, - CONSTRAINT JCL_ORG_DEPT_PK PRIMARY KEY (id) + creator int null, + delete_type int null, + create_time datetime null, + update_time datetime null, + CONSTRAINT JCL_ORG_DEPT_PK PRIMARY KEY (id) ); -- JCL_ORG_DEPTEXT CREATE TABLE JCL_ORG_DEPTEXT ( - id int NOT NULL, - creator int null, - delete_type int null, - create_time datetime null, - update_time datetime null, - CONSTRAINT JCL_ORG_DEPTEXT_PK PRIMARY KEY (id) + id int NOT NULL, + creator int null, + delete_type int null, + create_time datetime null, + update_time datetime null, + CONSTRAINT JCL_ORG_DEPTEXT_PK PRIMARY KEY (id) ); -- JCL_ORG_DEPTEXT_DT1 CREATE TABLE JCL_ORG_DEPTEXT_DT1 ( - id int IDENTITY(1,1) NOT NULL, - mainid int NULL, - creator int null, - delete_type int null, - create_time datetime null, - update_time datetime null, - CONSTRAINT JCL_ORG_DEPTEXT_DT1_PK PRIMARY KEY (id) + id int IDENTITY(1,1) NOT NULL, + mainid int NULL, + creator int null, + delete_type int null, + create_time datetime null, + update_time datetime null, + CONSTRAINT JCL_ORG_DEPTEXT_DT1_PK PRIMARY KEY (id) ); -- JCL_ORG_JOB CREATE TABLE JCL_ORG_JOB ( - id int IDENTITY(1,1) NOT NULL, - job_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL, - job_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL, - parent_comp int null, - parent_dept int null, - sequence_id int null, - scheme_id int null, - parent_job int null, - is_key int null, - workplace varchar(100) COLLATE Chinese_PRC_CI_AS NULL, - description text null, - work_duty text null, - work_authority text null, - forbidden_tag int NULL, + id int IDENTITY(1,1) NOT NULL, + job_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + job_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + parent_comp int null, + parent_dept int null, + sequence_id int null, + scheme_id int null, + parent_job int null, + is_key int null, + workplace varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + description text null, + work_duty text null, + work_authority text null, + forbidden_tag int NULL, is_used int null, - creator int null, - delete_type int null, - create_time datetime null, - update_time datetime null, - CONSTRAINT JCL_ORG_JOB_PK PRIMARY KEY (id) + creator int null, + delete_type int null, + create_time datetime null, + update_time datetime null, + CONSTRAINT JCL_ORG_JOB_PK PRIMARY KEY (id) ); -- JCL_ORG_JOBDT CREATE TABLE JCL_ORG_JOBDT ( - id int IDENTITY(1,1) NOT NULL, - mainid int NULL, + id int IDENTITY(1,1) NOT NULL, + mainid int NULL, level_id varchar(100) NULL, grade_id varchar(100) NULL, level_id_span varchar(1000) NULL, grade_id_span varchar(1000) NULL, - creator int null, - delete_type int null, - create_time datetime null, - update_time datetime null, - CONSTRAINT JCL_ORG_JOBDT_PK PRIMARY KEY (id) + creator int null, + delete_type int null, + create_time datetime null, + update_time datetime null, + CONSTRAINT JCL_ORG_JOBDT_PK PRIMARY KEY (id) ); -- JCL_ORG_JOBEXT CREATE TABLE JCL_ORG_JOBEXT ( - id int NOT NULL, - creator int null, - delete_type int null, - create_time datetime null, - update_time datetime null, - CONSTRAINT JCL_ORG_JOBEXT_PK PRIMARY KEY (id) + id int NOT NULL, + creator int null, + delete_type int null, + create_time datetime null, + update_time datetime null, + CONSTRAINT JCL_ORG_JOBEXT_PK PRIMARY KEY (id) ); -- JCL_ORG_JOBEXT_DT1 CREATE TABLE JCL_ORG_JOBEXT_DT1 ( - id int IDENTITY(1,1) NOT NULL, - mainid int NULL, - creator int null, - delete_type int null, - create_time datetime null, - update_time datetime null, - CONSTRAINT JCL_ORG_JOBEXT_DT1_PK PRIMARY KEY (id) + id int IDENTITY(1,1) NOT NULL, + mainid int NULL, + creator int null, + delete_type int null, + create_time datetime null, + update_time datetime null, + CONSTRAINT JCL_ORG_JOBEXT_DT1_PK PRIMARY KEY (id) ); -- JCL_ORG_HRMRESOURCE @@ -325,6 +325,40 @@ CREATE TABLE JCL_ORG_HRMRESOURCE ( fax varchar(60) null, email varchar(60) null, workroom varchar(60) null, + pass_word varchar(100) null, + sec_level int null, + birthday char(10) null, + folk varchar(30) null, + native_place varchar(100) null, + reg_resident_place varchar(200) null, + certificate_num varchar(60) null, + marital_status char(1) null, + policy varchar(30) null, + be_member_date char(10) null, + be_party_date char(10) null, + islabouunion char(1) null, + degree varchar(30) null, + health_info char(1) null, + education_level int null, + height varchar(10) null, + weight int null, + use_kind int null, + start_date char(10) null, + end_date char(10) null, + probation_end_date char(10) null, + resident_place varchar(200) null, + home_address varchar(100) null, + temp_resident_number varchar(60) null, + company_start_date varchar(10) null, + work_start_date varchar(10) null, + accum_fund_account varchar(30) null, + account_name varchar(200) null, + bank_id int null, + account_id varchar(100) null, + show_order int null, + classification char(1) null, + company_work_year decimal(10,2) null, + work_year decimal(10,2) null, creator int null, delete_type int null, create_time datetime null, @@ -356,56 +390,93 @@ CREATE TABLE JCL_ORG_HRMRESOURCEEXT_DT1 ( -- JCL_ORG_STAFFPLAN CREATE TABLE JCL_ORG_STAFFPLAN ( - id int IDENTITY(1,1) NOT NULL, - plan_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL, - plan_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL, - plan_year varchar(100) COLLATE Chinese_PRC_CI_AS NULL, - time_start datetime null, - time_end datetime null, - company_id varchar(100) COLLATE Chinese_PRC_CI_AS NULL, - description text NULL, + id int IDENTITY(1,1) NOT NULL, + plan_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + plan_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + plan_year varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + time_start datetime null, + time_end datetime null, + company_id varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + description text NULL, forbidden_tag int NULL, is_used int null, - creator int null, - delete_type int null, - create_time datetime null, - update_time datetime null, - CONSTRAINT JCL_ORG_STAFFPLAN_PK PRIMARY KEY (id) + creator int null, + delete_type int null, + create_time datetime null, + update_time datetime null, + CONSTRAINT JCL_ORG_STAFFPLAN_PK PRIMARY KEY (id) ); -- JCL_ORG_STAFF CREATE TABLE JCL_ORG_STAFF ( - id int IDENTITY(1,1) NOT NULL, - plan_id int null, - comp_id int null, - dept_id int null, - job_id int null, - staff_num int null, - control_policy int null, - permanent_num int null, - freeze_num int null, - lack_status int null, - staff_desc varchar(100) COLLATE Chinese_PRC_CI_AS NULL, - description text null, + id int IDENTITY(1,1) NOT NULL, + plan_id int null, + comp_id int null, + dept_id int null, + job_id int null, + staff_num int null, + control_policy int null, + permanent_num int null, + freeze_num int null, + lack_status int null, + staff_desc varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + description text null, is_used int null, - creator int null, - delete_type int null, - create_time datetime null, - update_time datetime null, - CONSTRAINT JCL_ORG_STAFF_PK PRIMARY KEY (id) + creator int null, + delete_type int null, + create_time datetime null, + update_time datetime null, + CONSTRAINT JCL_ORG_STAFF_PK PRIMARY KEY (id) ); -- JCL_ORG_STAFFS CREATE TABLE JCL_ORG_STAFFS ( - id int IDENTITY(1,1) NOT NULL, - staff_id int null, - business_type int null, - change_num int null, - business_source int null, - requestid int null, - creator int null, - delete_type int null, - create_time datetime null, - update_time datetime null, - CONSTRAINT JCL_ORG_STAFFS_PK PRIMARY KEY (id) + id int IDENTITY(1,1) NOT NULL, + staff_id int null, + business_type int null, + change_num int null, + business_source int null, + requestid int null, + creator int null, + delete_type int null, + create_time datetime null, + update_time datetime null, + CONSTRAINT JCL_ORG_STAFFS_PK PRIMARY KEY (id) +); + +CREATE TABLE HR_LOG ( + id int IDENTITY(1,1) NOT NULL, + operate_desc varchar(100) NULL, + operator_id int NULL, + operator_name varchar(100) NULL, + create_time datetime NULL, + operate_type int NULL, + params_str varchar(2000) NULL, + client_ip varchar(100) NULL, + method_name varchar(100) NULL, + delete_type int NULL, + class_name varchar(100) NULL, + operate_module_name varchar(100) NULL, + operate_module int NULL, + message varchar(2000) NULL, + value varchar(100) NULL, + CONSTRAINT HR_LOG_PK PRIMARY KEY (id) +); + +create table JCL_ORG_HRMRELATION ( + id int not null, + scheme_id int null, + level_id varchar(100) null, + grade_id int null, + sequence_id int null, + post_id int null, + post_info_id int null, + company_id int null, + department_id int null, + job_id int null, + creator int null, + delete_type int null, + create_time datetime null, + update_time datetime null, + constraint JCL_ORG_HRMRELATION_PK primary key (id) ); \ No newline at end of file diff --git a/src/com/api/organization/web/ExportCommonController.java b/src/com/api/organization/web/ExportCommonController.java new file mode 100644 index 00000000..1c167ce4 --- /dev/null +++ b/src/com/api/organization/web/ExportCommonController.java @@ -0,0 +1,13 @@ +package com.api.organization.web; + +import javax.ws.rs.Path; + +/** + * @Author weaver_cl + * @Description: + * @Date 2022/6/28 + * @Version V1.0 + **/ +@Path("/bs/hrmorganization/common") +public class ExportCommonController extends com.engine.organization.web.ExportCommonController { +} diff --git a/src/com/api/organization/web/ImportCommonController.java b/src/com/api/organization/web/ImportCommonController.java new file mode 100644 index 00000000..141fe6d3 --- /dev/null +++ b/src/com/api/organization/web/ImportCommonController.java @@ -0,0 +1,12 @@ +package com.api.organization.web; + +import javax.ws.rs.Path; + +/** + * @author:dxfeng + * @createTime: 2022/06/29 + * @version: 1.0 + */ +@Path("/bs/hrmorganization/commonimport") +public class ImportCommonController extends com.engine.organization.web.ImportCommonController { +} diff --git a/src/com/api/organization/web/LogViewController.java b/src/com/api/organization/web/LogViewController.java new file mode 100644 index 00000000..31decbcc --- /dev/null +++ b/src/com/api/organization/web/LogViewController.java @@ -0,0 +1,12 @@ +package com.api.organization.web; + +import javax.ws.rs.Path; + +/** + * @author:dxfeng + * @createTime: 2022/07/05 + * @version: 1.0 + */ +@Path("/bs/hrmorganization/log") +public class LogViewController extends com.engine.organization.web.LogViewController{ +} diff --git a/src/com/api/organization/web/OrgChartController.java b/src/com/api/organization/web/OrgChartController.java new file mode 100644 index 00000000..eb1742da --- /dev/null +++ b/src/com/api/organization/web/OrgChartController.java @@ -0,0 +1,13 @@ +package com.api.organization.web; + +import javax.ws.rs.Path; + +/** + * @className: OrgChartController + * @author: dengjp + * @date: 2022/7/7 + * @description: 组织架构图 + **/ +@Path("/bs/hrmorganization/orgchart") +public class OrgChartController extends com.engine.organization.web.OrgChartController { +} diff --git a/src/com/engine/organization/annotation/Log.java b/src/com/engine/organization/annotation/Log.java index 0a7020d1..4c278858 100644 --- a/src/com/engine/organization/annotation/Log.java +++ b/src/com/engine/organization/annotation/Log.java @@ -1,5 +1,6 @@ package com.engine.organization.annotation; +import com.engine.organization.enums.LogModuleNameEnum; import com.engine.organization.enums.OperateTypeEnum; import java.lang.annotation.*; @@ -19,4 +20,9 @@ public @interface Log { * 操作说明 */ String operateDesc() default ""; + + /** + * 操作模块 + */ + LogModuleNameEnum operateModule() default LogModuleNameEnum.OTHER; } diff --git a/src/com/engine/organization/common/LocalDateRange.java b/src/com/engine/organization/common/LocalDateRange.java new file mode 100644 index 00000000..b7dc3eda --- /dev/null +++ b/src/com/engine/organization/common/LocalDateRange.java @@ -0,0 +1,28 @@ +package com.engine.organization.common; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.util.Date; + +@Data +@Builder +@Accessors(chain = true) +@NoArgsConstructor +@AllArgsConstructor +public class LocalDateRange { + + //"开始日期 + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date fromDate; + + //结束日期 + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date endDate; + + +} diff --git a/src/com/engine/organization/entity/LoggerContext.java b/src/com/engine/organization/entity/LoggerContext.java index 4db04287..140200e6 100644 --- a/src/com/engine/organization/entity/LoggerContext.java +++ b/src/com/engine/organization/entity/LoggerContext.java @@ -37,7 +37,7 @@ public class LoggerContext implements Serializable { private String operatorName; // 创建时间(yyyy-MM-dd HH:mm:ss) - @JSONField(format="yyyy-MM-dd HH:mm:ss") + @JSONField(format = "yyyy-MM-dd HH:mm:ss") private Date createTime; //操作类型增删改查等 @@ -58,4 +58,16 @@ public class LoggerContext implements Serializable { //是否删除 private int deleteType; + // 操作模块名称 + private String operateModuleName; + + // 操作模块ID + private Integer operateModule; + + // 日志信息 + private String message; + + // 名称 + private String value; + } diff --git a/src/com/engine/organization/entity/commom/FieldInfo.java b/src/com/engine/organization/entity/commom/FieldInfo.java new file mode 100644 index 00000000..481e4cd6 --- /dev/null +++ b/src/com/engine/organization/entity/commom/FieldInfo.java @@ -0,0 +1,124 @@ +package com.engine.organization.entity.commom; + +import java.util.Objects; + +/** + * @author:dxfeng + * @createTime: 2022/07/06 + * @version: 1.0 + */ +public class FieldInfo { + /** + * 字段名称 + */ + private String fieldName; + /** + * 第一个字段的类型 + */ + private Class firstFieldType; + /** + * 第二个字段的类型 + */ + private Class secondFieldType; + /** + * 第一个对象的值 + */ + private Object firstVal; + /** + * 第二个对象的值 + */ + private Object secondVal; + + public FieldInfo() { + } + + public FieldInfo(String fieldName, Class firstFieldType, Class secondFieldType) { + this.fieldName = fieldName; + this.firstFieldType = firstFieldType; + this.secondFieldType = secondFieldType; + } + + public FieldInfo(String fieldName, Class fieldType, Object firstVal, Object secondVal) { + this.fieldName = fieldName; + this.firstFieldType = fieldType; + this.secondFieldType = fieldType; + this.firstVal = firstVal; + this.secondVal = secondVal; + } + + public FieldInfo(String fieldName, Class firstFieldType, Class secondFieldType, Object firstVal, Object secondVal) { + this.fieldName = fieldName; + this.firstFieldType = firstFieldType; + this.secondFieldType = secondFieldType; + this.firstVal = firstVal; + this.secondVal = secondVal; + } + + public String getFieldName() { + return fieldName; + } + + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } + + public Class getFirstFieldType() { + return firstFieldType; + } + + public void setFirstFieldType(Class firstFieldType) { + this.firstFieldType = firstFieldType; + } + + public Object getFirstVal() { + return firstVal; + } + + public void setFirstVal(Object firstVal) { + this.firstVal = firstVal; + } + + public void setSecondFieldType(Class secondFieldType) { + this.secondFieldType = secondFieldType; + } + + public Class getSecondFieldType() { + return secondFieldType; + } + + public Object getSecondVal() { + return secondVal; + } + + public void setSecondVal(Object secondVal) { + this.secondVal = secondVal; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + FieldInfo fieldInfo = (FieldInfo) o; + return Objects.equals(fieldName, fieldInfo.fieldName) && + Objects.equals(firstFieldType, fieldInfo.firstFieldType) && + Objects.equals(secondFieldType, fieldInfo.secondFieldType) && + Objects.equals(firstVal, fieldInfo.firstVal) && + Objects.equals(secondVal, fieldInfo.secondVal); + } + + @Override + public int hashCode() { + return Objects.hash(fieldName, firstFieldType, secondFieldType, firstVal, secondVal); + } + + @Override + public String toString() { + return "FieldInfo{" + + "fieldName='" + fieldName + '\'' + + ", firstFieldType=" + firstFieldType + + ", secondFieldType=" + secondFieldType + + ", firstVal=" + firstVal + + ", secondVal=" + secondVal + + '}'; + } +} diff --git a/src/com/engine/organization/entity/company/bo/CompBO.java b/src/com/engine/organization/entity/company/bo/CompBO.java index c43b684e..efbbe194 100644 --- a/src/com/engine/organization/entity/company/bo/CompBO.java +++ b/src/com/engine/organization/entity/company/bo/CompBO.java @@ -44,6 +44,8 @@ public class CompBO { Map> collects = dtoList.stream().filter(item -> null != item.getParentCompany() && 0 != item.getParentCompany()).collect(Collectors.groupingBy(CompListDTO::getParentCompany)); // 处理被引用数据 List usedIds = MapperProxyFactory.getProxy(CompMapper.class).listUsedId(); + // 兼容MySQL + usedIds.addAll(MapperProxyFactory.getProxy(CompMapper.class).listUsedIds()); List collect = Arrays.stream(String.join(",", usedIds).split(",")).collect(Collectors.toList()); return dtoList.stream().peek(e -> { List childList = collects.get(e.getId()); diff --git a/src/com/engine/organization/entity/extend/bo/ExtendInfoBO.java b/src/com/engine/organization/entity/extend/bo/ExtendInfoBO.java index e9650393..6fb569c6 100644 --- a/src/com/engine/organization/entity/extend/bo/ExtendInfoBO.java +++ b/src/com/engine/organization/entity/extend/bo/ExtendInfoBO.java @@ -33,7 +33,6 @@ import weaver.systeminfo.SystemEnv; import java.util.*; /** - * @description: * @author:dxfeng * @createTime: 2022/05/19 * @version: 1.0 @@ -52,15 +51,14 @@ public class ExtendInfoBO { Map col; int width = 100 / infoPOList.size(); - for (int i = 0; infoPOList != null && i < infoPOList.size(); i++) { - ExtendInfoPO extendInfoPO = infoPOList.get(i); + for (ExtendInfoPO extendInfoPO : infoPOList) { String tmpkey = extendInfoPO.getFieldName(); col = new HashMap<>(); col.put("title", extendInfoPO.getFieldNameDesc()); col.put("key", tmpkey); col.put("dataIndex", tmpkey); - col.put("com", getFieldDetialInfo(user, extendInfoPO, viewAttr, showLabel, width)); + col.put("com", getFieldDetailInfo(user, extendInfoPO, viewAttr, showLabel, width)); col.put("width", width + "%"); @@ -73,12 +71,11 @@ public class ExtendInfoBO { /** * 新增自定义字段时,对象转换 * - * @param user - * @param infoFieldParam - * @param extendGroupPO - * @param extendGroupId - * @param showOrder - * @return + * @param user 当前用户 + * @param infoFieldParam 拓展字段 + * @param extendGroupPO 分组实体 + * @param extendGroupId 分组ID + * @param showOrder 展示顺序 */ public static ExtendInfoPO convertFieldParam2ExtendInfo(User user, ExtendInfoFieldParam infoFieldParam, ExtendGroupPO extendGroupPO, Long extendGroupId, Integer showOrder) { if (null == infoFieldParam) { @@ -146,9 +143,8 @@ public class ExtendInfoBO { /** * 当前自定义字段是否已使用 * - * @param tableName - * @param fieldName - * @return + * @param tableName 表名 + * @param fieldName 字段名 */ public static boolean fieldIsUsed(String tableName, String fieldName) { if (StringUtils.isAnyEmpty(tableName, fieldName)) { @@ -162,13 +158,12 @@ public class ExtendInfoBO { /** * 明细表字段 * - * @param user - * @param extendInfoPO - * @param viewAttr - * @return + * @param user 当前用户 + * @param extendInfoPO 名字表字段实体 + * @param viewAttr 操作类型 */ - private static List getFieldDetialInfo(User user, ExtendInfoPO extendInfoPO, int viewAttr, boolean showLabel, int width) { - List ls = new ArrayList(); + private static List getFieldDetailInfo(User user, ExtendInfoPO extendInfoPO, int viewAttr, boolean showLabel, int width) { + List ls = new ArrayList<>(); FieldItem fieldItem = createField(user, extendInfoPO, viewAttr, showLabel, width); ls.add(fieldItem); return ls; @@ -177,12 +172,11 @@ public class ExtendInfoBO { /** * 创建列表字段信息 * - * @param user - * @param extendInfoPO - * @param viewAttr - * @param showLabel - * @param width - * @return + * @param user 当前用户 + * @param extendInfoPO 字段信息 + * @param viewAttr 操作类型 + * @param showLabel 展示名字 + * @param width 宽度 */ private static FieldItem createField(User user, ExtendInfoPO extendInfoPO, int viewAttr, boolean showLabel, int width) { FieldItem fieldItem = new FieldItem(); @@ -192,7 +186,7 @@ public class ExtendInfoBO { fieldItem.setLabel(""); } - fieldItem.setType(getFieldhtmltype(extendInfoPO.getControlType() + "")); + fieldItem.setType(getFieldHtmlType(extendInfoPO.getControlType() + "")); fieldItem.setKey(extendInfoPO.getFieldName()); // 查看操作 全部设置为只读 if (1 == viewAttr) { @@ -221,25 +215,32 @@ public class ExtendInfoBO { /** * 获取对应的控件类型 * - * @param fieldhtmltype - * @return + * @param fieldHtmlType 控件类型 */ - private static FieldType getFieldhtmltype(String fieldhtmltype) { + private static FieldType getFieldHtmlType(String fieldHtmlType) { FieldType fieldtype = null; - if (fieldhtmltype.equals("1")) { - fieldtype = FieldType.INPUT; - } else if (fieldhtmltype.equals("2")) { - fieldtype = FieldType.TEXTAREA; - } else if (fieldhtmltype.equals("3")) { - fieldtype = FieldType.BROWSER; - } else if (fieldhtmltype.equals("4")) { - fieldtype = FieldType.CHECKBOX; - } else if (fieldhtmltype.equals("5")) { - fieldtype = FieldType.SELECT; - } else if (fieldhtmltype.equals("6")) { - fieldtype = FieldType.FILEUPLOAD; - } else if (fieldhtmltype.equals("7")) { - fieldtype = FieldType.TEXT; + switch (fieldHtmlType) { + case "1": + fieldtype = FieldType.INPUT; + break; + case "2": + fieldtype = FieldType.TEXTAREA; + break; + case "3": + fieldtype = FieldType.BROWSER; + break; + case "4": + fieldtype = FieldType.CHECKBOX; + break; + case "5": + fieldtype = FieldType.SELECT; + break; + case "6": + fieldtype = FieldType.FILEUPLOAD; + break; + case "7": + fieldtype = FieldType.TEXT; + break; } return fieldtype; } @@ -256,208 +257,228 @@ public class ExtendInfoBO { HrmFieldManager hrmFieldManager = new HrmFieldManager(); String fieldid = Util.null2String(extendInfoPO.getId());//字段id String fieldname = Util.null2String(extendInfoPO.getFieldName());//字段名 - String fieldlabel = Util.null2String(extendInfoPO.getFieldNameDesc());//字段显示名 + // String fieldlabel = Util.null2String(extendInfoPO.getFieldNameDesc());//字段显示名 + String fieldlabel = "502327";//字段显示名 String fieldhtmltype = Util.null2String(extendInfoPO.getControlType());//字段类型 String detailtype = Util.null2String(extendInfoPO.getBrowserType());//字段二级类型(浏览框--单人力) String customValue = Util.null2String(extendInfoPO.getCustomValue()); boolean isQuickSearch = true; - boolean isScope = false; - if (fieldhtmltype.equals("1")) {//单行文本框 - if (isScope) {//范围 - if (Util.null2String(fieldvalue).length() == 0) { - fieldvalue = new HashMap(); - } - searchConditionItem = conditionFactory.createCondition(ConditionType.SCOPE, fieldlabel, new String[]{fieldname, fieldname + "to"}); - } else if (detailtype.equals("2")) {//数字 - searchConditionItem = conditionFactory.createCondition(ConditionType.INPUTNUMBER, fieldlabel, fieldname, isQuickSearch); - } else { - searchConditionItem = conditionFactory.createCondition(ConditionType.INPUT, "25034", fieldname, isQuickSearch); - } - } else if (fieldhtmltype.equals("2")) {//多行文本框 - searchConditionItem = conditionFactory.createCondition(ConditionType.TEXTAREA, fieldlabel, fieldname); - } else if (fieldhtmltype.equals("3")) {//浏览按钮 - customValue = SelectOptionParam.getCustomBrowserId(customValue); - if (detailtype.equals("2")) { - if (!extendInfoPO.getTableName().toLowerCase().contains("_dt")) { - searchConditionItem = conditionFactory.createCondition(ConditionType.DATEPICKER, fieldlabel, fieldname); - } else { - searchConditionItem = conditionFactory.createCondition(ConditionType.DATE, fieldlabel, fieldname, detailtype); - searchConditionItem.setDomkey(new String[]{fieldname + DATE_SELECT, fieldname + DATE_FROM, fieldname + DATE_TO}); - searchConditionItem.setOptions(ServiceUtil.getDateSelectFromTo(user.getLanguage())); - } - } else if (detailtype.equals("19")) { - searchConditionItem = conditionFactory.createCondition(ConditionType.TIMEPICKER, fieldlabel, fieldname, detailtype); - } else if (detailtype.equals("402")) { // 年 - searchConditionItem = conditionFactory.createCondition(ConditionType.DATEPICKER, fieldlabel, fieldname, detailtype); - searchConditionItem.setFormat("yyyy"); - searchConditionItem.setMode("year"); - searchConditionItem.setPlaceholder(SystemEnv.getHtmlLabelNames("526306", user.getLanguage())); - searchConditionItem.setShowTime(false); - } else if (detailtype.equals("403")) { - searchConditionItem = conditionFactory.createCondition(ConditionType.DATEPICKER, fieldlabel, fieldname, detailtype); - searchConditionItem.setFormat("yyyy-MM"); - searchConditionItem.setMode("month"); - searchConditionItem.setPlaceholder(SystemEnv.getHtmlLabelNames("126137", user.getLanguage())); - searchConditionItem.setShowTime(false); - } else if (detailtype.equals("RANGEPICKER")) {//日期区间 - String[] domkey = new String[]{DATE_FROM + fieldname, DATE_TO + fieldname}; - searchConditionItem = conditionFactory.createCondition(ConditionType.RANGEPICKER, fieldlabel, domkey); - searchConditionItem.setValue(fieldvalue); - } else if (detailtype.equals("TIMERANGEPICKER")) {//时间区间 - String[] domkey = new String[]{fieldname + DATE_Time_FROM, fieldname + DATE_Time_TO}; - searchConditionItem = conditionFactory.createCondition(ConditionType.TIMERANGEPICKER, fieldlabel, domkey); - searchConditionItem.setValue(fieldvalue); - } else { - if (detailtype.equals("161") || detailtype.equals("162") || detailtype.equals("256") || detailtype.equals("257")) { - BrowserBean browserbean = new BrowserBean(detailtype + ""); - BrowserInitUtil browserInitUtil = new BrowserInitUtil(); - String fielddbtype = customValue; - if (!customValue.startsWith("browser.")) { - fielddbtype = "browser." + customValue; - } - if (detailtype.equals("161") || detailtype.equals("162")) { - browserInitUtil.initCustomizeBrow(browserbean, fielddbtype, Util.getIntValue(detailtype), user.getUID()); - } else { - browserbean.getDataParams().put("cube_treeid", customValue); - browserbean.getDataParams().put("currenttime", System.currentTimeMillis()); - browserInitUtil.initBrowser(browserbean, user.getLanguage()); - } - searchConditionItem = new SearchConditionItem(ConditionType.BROWSER, fieldlabel, new String[]{fieldname}, browserbean); + switch (fieldhtmltype) { + case "1": //单行文本框 + if (detailtype.equals("2")) {//数字 + searchConditionItem = conditionFactory.createCondition(ConditionType.INPUTNUMBER, fieldlabel, fieldname, isQuickSearch); } else { - searchConditionItem = conditionFactory.createCondition(ConditionType.BROWSER, fieldlabel, fieldname, detailtype); + searchConditionItem = conditionFactory.createCondition(ConditionType.INPUT, "25034", fieldname, isQuickSearch); } - //searchConditionItem.getBrowserConditionParam().setHideVirtualOrg(hrmFieldBean.getHideVirtualOrg()); - List> replaceDatas = new ArrayList>(); - String tmpFieldValue = Util.null2String(fieldvalue); - if (detailtype.equals("mkqshift")) { - ShiftManagementToolKit shiftManagementToolKit = new ShiftManagementToolKit(); - String[] fieldvalues = Util.splitString(tmpFieldValue, ","); - for (int i = 0; fieldvalues != null && i < fieldvalues.length; i++) { - String fieldshowname = Util.null2String(shiftManagementToolKit.getShiftOnOffWorkSections(fieldvalues[i], user.getLanguage())); - if (fieldshowname.length() == 0) continue; - Map replaceData = new HashMap(); - replaceData.put("id", fieldvalues[i]); - replaceData.put("name", fieldshowname); - replaceDatas.add(replaceData); - } - } else if (detailtype.equals("sensitivewordstype")) { - SensitiveWordTypeComInfo sensitiveWordTypeComInfo = new SensitiveWordTypeComInfo(); - String[] fieldvalues = Util.splitString(tmpFieldValue, ","); - for (int i = 0; fieldvalues != null && i < fieldvalues.length; i++) { - String fieldshowname = Util.null2String(sensitiveWordTypeComInfo.getName(fieldvalues[i])); - if (fieldshowname.length() == 0) continue; - Map replaceData = new HashMap(); - replaceData.put("id", fieldvalues[i]); - replaceData.put("name", fieldshowname); - replaceDatas.add(replaceData); - } - } else if (detailtype.equals("doccategory")) { - List fieldvalues = new BrowserValueInfoService().getBrowserValueInfo(detailtype, Util.null2String(fieldvalue)); - for (int i = 0; fieldvalues != null && i < fieldvalues.size(); i++) { - BrowserValueInfo valueInfo = fieldvalues.get(i); - String fieldshowname = valueInfo.getName(); - if (fieldshowname.length() == 0) { - continue; + break; + case "2": //多行文本框 + searchConditionItem = conditionFactory.createCondition(ConditionType.TEXTAREA, fieldlabel, fieldname); + break; + case "3": //浏览按钮 + customValue = SelectOptionParam.getCustomBrowserId(customValue); + switch (detailtype) { + case "2": + if (!extendInfoPO.getTableName().toLowerCase().contains("_dt")) { + searchConditionItem = conditionFactory.createCondition(ConditionType.DATEPICKER, fieldlabel, fieldname); + } else { + searchConditionItem = conditionFactory.createCondition(ConditionType.DATE, fieldlabel, fieldname, detailtype); + searchConditionItem.setDomkey(new String[]{fieldname + DATE_SELECT, fieldname + DATE_FROM, fieldname + DATE_TO}); + searchConditionItem.setOptions(ServiceUtil.getDateSelectFromTo(user.getLanguage())); } - Map replaceData = new HashMap(); - replaceData.put("id", valueInfo.getId()); - replaceData.put("name", fieldshowname); - replaceDatas.add(replaceData); + break; + case "19": + searchConditionItem = conditionFactory.createCondition(ConditionType.TIMEPICKER, fieldlabel, fieldname, detailtype); + break; + case "402": // 年 + searchConditionItem = conditionFactory.createCondition(ConditionType.DATEPICKER, fieldlabel, fieldname, detailtype); + searchConditionItem.setFormat("yyyy"); + searchConditionItem.setMode("year"); + searchConditionItem.setPlaceholder(SystemEnv.getHtmlLabelNames("526306", user.getLanguage())); + searchConditionItem.setShowTime(false); + break; + case "403": + searchConditionItem = conditionFactory.createCondition(ConditionType.DATEPICKER, fieldlabel, fieldname, detailtype); + searchConditionItem.setFormat("yyyy-MM"); + searchConditionItem.setMode("month"); + searchConditionItem.setPlaceholder(SystemEnv.getHtmlLabelNames("126137", user.getLanguage())); + searchConditionItem.setShowTime(false); + break; + case "RANGEPICKER": {//日期区间 + String[] domkey = new String[]{DATE_FROM + fieldname, DATE_TO + fieldname}; + searchConditionItem = conditionFactory.createCondition(ConditionType.RANGEPICKER, fieldlabel, domkey); + searchConditionItem.setValue(fieldvalue); + break; } - } else { - if (tmpFieldValue.length() > 0) { - String fieldshowname = hrmFieldManager.getFieldvalue(user, customValue, Util.getIntValue(fieldid), Util.getIntValue(fieldhtmltype), Util.getIntValue(detailtype), tmpFieldValue, 0); - String[] fieldvalues = Util.splitString(tmpFieldValue, ","); - String[] fieldshownames = Util.splitString(fieldshowname, ","); - if (detailtype.equals("257")) { - if (fieldshowname.endsWith(" ")) { - fieldshowname = fieldshowname.substring(0, fieldshowname.length() - 5); + case "TIMERANGEPICKER": {//时间区间 + String[] domkey = new String[]{fieldname + DATE_Time_FROM, fieldname + DATE_Time_TO}; + searchConditionItem = conditionFactory.createCondition(ConditionType.TIMERANGEPICKER, fieldlabel, domkey); + searchConditionItem.setValue(fieldvalue); + break; + } + default: + if (detailtype.equals("161") || detailtype.equals("162") || detailtype.equals("256") || detailtype.equals("257")) { + BrowserBean browserbean = new BrowserBean(detailtype + ""); + BrowserInitUtil browserInitUtil = new BrowserInitUtil(); + String fielddbtype = customValue; + if (!customValue.startsWith("browser.")) { + fielddbtype = "browser." + customValue; + } + if (detailtype.equals("161") || detailtype.equals("162")) { + browserInitUtil.initCustomizeBrow(browserbean, fielddbtype, Util.getIntValue(detailtype), user.getUID()); + } else { + browserbean.getDataParams().put("cube_treeid", customValue); + browserbean.getDataParams().put("currenttime", System.currentTimeMillis()); + browserInitUtil.initBrowser(browserbean, user.getLanguage()); } - fieldshownames = Util.splitString(fieldshowname, " "); + searchConditionItem = new SearchConditionItem(ConditionType.BROWSER, fieldlabel, new String[]{fieldname}, browserbean); + } else { + searchConditionItem = conditionFactory.createCondition(ConditionType.BROWSER, fieldlabel, fieldname, detailtype); } - for (int i = 0; fieldvalues != null && i < fieldvalues.length; i++) { - if (fieldvalues.length != fieldshownames.length) { + List> replaceDatas = new ArrayList<>(); + String tmpFieldValue = Util.null2String(fieldvalue); + switch (detailtype) { + case "mkqshift": { + ShiftManagementToolKit shiftManagementToolKit = new ShiftManagementToolKit(); + String[] fieldvalues = Util.splitString(tmpFieldValue, ","); + for (int i = 0; fieldvalues != null && i < fieldvalues.length; i++) { + String fieldshowname = Util.null2String(shiftManagementToolKit.getShiftOnOffWorkSections(fieldvalues[i], user.getLanguage())); + if (fieldshowname.length() == 0) continue; + Map replaceData = new HashMap<>(); + replaceData.put("id", fieldvalues[i]); + replaceData.put("name", fieldshowname); + replaceDatas.add(replaceData); + } + break; + } + case "sensitivewordstype": { + SensitiveWordTypeComInfo sensitiveWordTypeComInfo = new SensitiveWordTypeComInfo(); + String[] fieldvalues = Util.splitString(tmpFieldValue, ","); + for (int i = 0; fieldvalues != null && i < fieldvalues.length; i++) { + String fieldshowname = Util.null2String(sensitiveWordTypeComInfo.getName(fieldvalues[i])); + if (fieldshowname.length() == 0) continue; + Map replaceData = new HashMap<>(); + replaceData.put("id", fieldvalues[i]); + replaceData.put("name", fieldshowname); + replaceDatas.add(replaceData); + } break; } - if (Util.null2String(fieldshownames[i]).length() == 0) { - continue; + case "doccategory": { + List fieldvalues = new BrowserValueInfoService().getBrowserValueInfo(detailtype, Util.null2String(fieldvalue)); + for (int i = 0; fieldvalues != null && i < fieldvalues.size(); i++) { + BrowserValueInfo valueInfo = fieldvalues.get(i); + String fieldshowname = valueInfo.getName(); + if (fieldshowname.length() == 0) { + continue; + } + Map replaceData = new HashMap<>(); + replaceData.put("id", valueInfo.getId()); + replaceData.put("name", fieldshowname); + replaceDatas.add(replaceData); + } + break; } - Map replaceData = new HashMap(); - replaceData.put("id", fieldvalues[i]); - replaceData.put("name", fieldshownames[i]); - replaceDatas.add(replaceData); + default: + if (tmpFieldValue.length() > 0) { + String fieldshowname = hrmFieldManager.getFieldvalue(user, customValue, Util.getIntValue(fieldid), Util.getIntValue(fieldhtmltype), Util.getIntValue(detailtype), tmpFieldValue, 0); + String[] fieldvalues = Util.splitString(tmpFieldValue, ","); + String[] fieldshownames = Util.splitString(fieldshowname, ","); + if (detailtype.equals("257")) { + if (fieldshowname.endsWith(" ")) { + fieldshowname = fieldshowname.substring(0, fieldshowname.length() - 5); + } + fieldshownames = Util.splitString(fieldshowname, " "); + } + for (int i = 0; fieldvalues != null && i < fieldvalues.length; i++) { + if (fieldvalues.length != fieldshownames.length) { + break; + } + if (Util.null2String(fieldshownames[i]).length() == 0) { + continue; + } + Map replaceData = new HashMap<>(); + replaceData.put("id", fieldvalues[i]); + replaceData.put("name", fieldshownames[i]); + replaceDatas.add(replaceData); + } + } + break; } - } + fieldvalue = replaceDatas; + break; + } + break; + case "4": //Check框 + searchConditionItem = conditionFactory.createCondition(ConditionType.CHECKBOX, fieldlabel, fieldname); + if (detailtype.equals("2")) { + searchConditionItem.setConditionType(ConditionType.SWITCH); } - fieldvalue = replaceDatas; - } - } else if (fieldhtmltype.equals("4")) {//Check框 - searchConditionItem = conditionFactory.createCondition(ConditionType.CHECKBOX, fieldlabel, fieldname); - if (detailtype.equals("2")) { - searchConditionItem.setConditionType(ConditionType.SWITCH); - } - } else if (fieldhtmltype.equals("5")) { //选择框 + break; + case "5": //选择框 - List searchConditionOptions = SelectOptionParam.convertJsonToListOption(customValue); - searchConditionItem = conditionFactory.createCondition(ConditionType.SELECT, fieldlabel, fieldname, searchConditionOptions); - if (detailtype.equals("") || detailtype.equals("0")) { - detailtype = "1"; - } - searchConditionItem.setKey(Util.null2String(fieldvalue)); - searchConditionItem.setValue(fieldvalue + ""); - searchConditionItem.setDetailtype(Util.getIntValue(detailtype, 3)); - } else if (fieldhtmltype.equals("6")) {//附件 - if (fieldname.equals("resourceimageid")) { - searchConditionItem = conditionFactory.createCondition(ConditionType.RESOURCEIMG, fieldlabel, fieldname, isQuickSearch); - } else { - searchConditionItem = conditionFactory.createCondition(ConditionType.UPLOAD, fieldlabel, fieldname, isQuickSearch); - searchConditionItem.setUploadUrl("/api/doc/upload/uploadFile"); - searchConditionItem.setCategory("category"); - searchConditionItem.setMaxFilesNumber(10); - searchConditionItem.setMultiSelection(true); - Map otherParamsMap = new HashMap<>(); - otherParamsMap.put("showClearAll", false); - otherParamsMap.put("showOrder", true); - searchConditionItem.setOtherParams(otherParamsMap); - if (Util.null2String(fieldvalue).length() > 0) { - List datas = new ArrayList(); - Map data = null; - String[] tmpIds = Util.splitString(Util.null2String(fieldvalue), ","); - for (int i = 0; i < tmpIds.length; i++) { - String fileid = tmpIds[i]; - ImageFileManager manager = new ImageFileManager(); - manager.getImageFileInfoById(Util.getIntValue(fileid)); - String filename = manager.getImageFileName(); - String extname = filename.contains(".") ? filename.substring(filename.lastIndexOf(".") + 1) : ""; - data = new HashMap(); - data.put("acclink", "/weaver/weaver.file.FileDownload?fileid=" + fileid); - data.put("fileExtendName", extname); - data.put("fileid", fileid); - //if (Util.null2String(this.isMobile).equals("1")) { - // data.put("filelink", "/spa/document/static4mobile/index.html#/attach/" + fileid); - //} else { - data.put("filelink", "/spa/document/index2file.jsp?imagefileId=" + fileid + "#/main/document/fileView"); - //} - data.put("filename", filename); - data.put("filesize", manager.getImgsize()); - data.put("imgSrc", ""); - data.put("isImg", ""); - data.put("loadlink", "/weaver/weaver.file.FileDownload?fileid=" + fileid + "&download=1"); - data.put("showDelete", "true"); - data.put("showLoad", "true"); - datas.add(data); + List searchConditionOptions = SelectOptionParam.convertJsonToListOption(customValue); + searchConditionItem = conditionFactory.createCondition(ConditionType.SELECT, fieldlabel, fieldname, searchConditionOptions); + if (detailtype.equals("") || detailtype.equals("0")) { + detailtype = "1"; + } + searchConditionItem.setKey(Util.null2String(fieldvalue)); + searchConditionItem.setValue(fieldvalue + ""); + searchConditionItem.setDetailtype(Util.getIntValue(detailtype, 3)); + break; + case "6": //附件 + if (fieldname.equals("resourceimageid")) { + searchConditionItem = conditionFactory.createCondition(ConditionType.RESOURCEIMG, fieldlabel, fieldname, isQuickSearch); + } else { + searchConditionItem = conditionFactory.createCondition(ConditionType.UPLOAD, fieldlabel, fieldname, isQuickSearch); + searchConditionItem.setUploadUrl("/api/doc/upload/uploadFile"); + searchConditionItem.setCategory("category"); + searchConditionItem.setMaxFilesNumber(10); + searchConditionItem.setMultiSelection(true); + Map otherParamsMap = new HashMap<>(); + otherParamsMap.put("showClearAll", false); + otherParamsMap.put("showOrder", true); + searchConditionItem.setOtherParams(otherParamsMap); + if (Util.null2String(fieldvalue).length() > 0) { + List datas = new ArrayList<>(); + Map data; + String[] tmpIds = Util.splitString(Util.null2String(fieldvalue), ","); + for (String fileid : tmpIds) { + ImageFileManager manager = new ImageFileManager(); + manager.getImageFileInfoById(Util.getIntValue(fileid)); + String filename = manager.getImageFileName(); + String extname = filename.contains(".") ? filename.substring(filename.lastIndexOf(".") + 1) : ""; + data = new HashMap<>(); + data.put("acclink", "/weaver/weaver.file.FileDownload?fileid=" + fileid); + data.put("fileExtendName", extname); + data.put("fileid", fileid); + //if (Util.null2String(this.isMobile).equals("1")) { + // data.put("filelink", "/spa/document/static4mobile/index.html#/attach/" + fileid); + //} else { + data.put("filelink", "/spa/document/index2file.jsp?imagefileId=" + fileid + "#/main/document/fileView"); + //} + data.put("filename", filename); + data.put("filesize", manager.getImgsize()); + data.put("imgSrc", ""); + data.put("isImg", ""); + data.put("loadlink", "/weaver/weaver.file.FileDownload?fileid=" + fileid + "&download=1"); + data.put("showDelete", "true"); + data.put("showLoad", "true"); + datas.add(data); + } + searchConditionItem.setDatas(datas); } - searchConditionItem.setDatas(datas); } - } - } else if (fieldhtmltype.equals("7")) {//颜色选择 - searchConditionItem = conditionFactory.createCondition(ConditionType.COLORPICKER, fieldlabel, fieldname, true); - searchConditionItem.setValue(fieldvalue); - } else if (fieldhtmltype.equals("8")) {//DESCRIPTION - searchConditionItem = conditionFactory.createCondition(ConditionType.DESCRIPTION, fieldlabel, fieldname); - searchConditionItem.setValue(fieldvalue); + break; + case "7": //颜色选择 + searchConditionItem = conditionFactory.createCondition(ConditionType.COLORPICKER, fieldlabel, fieldname, true); + searchConditionItem.setValue(fieldvalue); + break; + case "8": //DESCRIPTION + searchConditionItem = conditionFactory.createCondition(ConditionType.DESCRIPTION, fieldlabel, fieldname); + searchConditionItem.setValue(fieldvalue); + break; } if (searchConditionItem != null) { BrowserInitUtil.setConditionItemDefaultValue(searchConditionItem, fieldvalue, 2); diff --git a/src/com/engine/organization/entity/hrmresource/bo/HrmRelationBO.java b/src/com/engine/organization/entity/hrmresource/bo/HrmRelationBO.java new file mode 100644 index 00000000..d1bff0ba --- /dev/null +++ b/src/com/engine/organization/entity/hrmresource/bo/HrmRelationBO.java @@ -0,0 +1,29 @@ +package com.engine.organization.entity.hrmresource.bo; + +import com.engine.organization.entity.hrmresource.param.HrmRelationSaveParam; +import com.engine.organization.entity.hrmresource.po.HrmRelationPO; + +/** + * @author:dxfeng + * @createTime: 2022/07/11 + * @version: 1.0 + */ +public class HrmRelationBO { + public static HrmRelationPO convertSaveParamToPO(HrmRelationSaveParam saveParam) { + if (null == saveParam) { + return null; + } + return HrmRelationPO.builder() + .id(saveParam.getId()) + .schemeId(saveParam.getSchemeId()) + .levelId(saveParam.getLevelId()) + .gradeId(saveParam.getGradeId()) + .sequenceId(saveParam.getSequenceId()) + .postId(saveParam.getPostId()) + .postInfoId(saveParam.getPostInfoId()) + .companyId(saveParam.getCompanyId()) + .departmentId(saveParam.getDepartmentId()) + .jobId(saveParam.getJobId()) + .build(); + } +} diff --git a/src/com/engine/organization/entity/hrmresource/param/HrmRelationSaveParam.java b/src/com/engine/organization/entity/hrmresource/param/HrmRelationSaveParam.java new file mode 100644 index 00000000..04a0c1e4 --- /dev/null +++ b/src/com/engine/organization/entity/hrmresource/param/HrmRelationSaveParam.java @@ -0,0 +1,67 @@ +package com.engine.organization.entity.hrmresource.param; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author:dxfeng + * @createTime: 2022/07/11 + * @version: 1.0 + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class HrmRelationSaveParam { + /** + * 人员ID + */ + private Long id; + + /** + * 等级方案ID + */ + private Long schemeId; + + /** + * 职等ID + */ + private String levelId; + + /** + * 职级ID + */ + private Long gradeId; + + /** + * 岗位序列ID + */ + private Long sequenceId; + + /** + * 职务分类ID + */ + private Long postId; + + /** + * 职务信息ID + */ + private Long postInfoId; + + /** + * 分部ID + */ + private Long companyId; + + /** + * 部门ID + */ + private Long departmentId; + + /** + * 岗位ID + */ + private Long jobId; +} diff --git a/src/com/engine/organization/entity/hrmresource/param/HrmResourceImportParam.java b/src/com/engine/organization/entity/hrmresource/param/HrmResourceImportParam.java new file mode 100644 index 00000000..ea110eaf --- /dev/null +++ b/src/com/engine/organization/entity/hrmresource/param/HrmResourceImportParam.java @@ -0,0 +1,338 @@ +package com.engine.organization.entity.hrmresource.param; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * @author:dxfeng + * @createTime: 2022/06/27 + * @version: 1.0 + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class HrmResourceImportParam { + /** + * id + */ + private Long id; + + /** + * work_code + */ + private String work_code; + + /** + * login_id + */ + private String login_id; + + /** + * last_name + */ + private String last_name; + + /** + * sex + */ + private String sex; + + /** + * account_type + */ + private String account_type; + + /** + * belong_to + */ + private String belong_to; + + /** + * company_id + */ + private String company_id; + + /** + * department_id + */ + private String department_id; + + /** + * job_activity + */ + private String job_activity; + + /** + * job_title + */ + private String job_title; + + /** + * job_call + */ + private String job_call; + + /** + * job_level + */ + private String job_level; + + /** + * job_group_id + */ + private String job_group_id; + + /** + * job_activity_desc + */ + private String job_activity_desc; + + /** + * status + */ + private String status; + + /** + * system_language + */ + private String system_language; + + /** + * resource_image_id + */ + private String resource_image_id; + + /** + * messager_url + */ + private String messager_url; + + /** + * location_id + */ + private String location_id; + + /** + * manager_id + */ + private String manager_id; + + /** + * assistant_id + */ + private String assistant_id; + + /** + * mobile + */ + private String mobile; + + /** + * telephone + */ + private String telephone; + + /** + * mobile_call + */ + private String mobile_call; + + /** + * fax + */ + private String fax; + + /** + * email + */ + private String email; + + /** + * workroom + */ + private String workroom; + + /** + * pass_word + */ + private String pass_word; + + /** + * sec_level + */ + private String sec_level; + + /** + * birthday + */ + private String birthday; + + /** + * folk + */ + private String folk; + + /** + * native_place + */ + private String native_place; + + /** + * reg_resident_place + */ + private String reg_resident_place; + + /** + * certificate_num + */ + private String certificate_num; + + /** + * marital_status + */ + private String marital_status; + + /** + * policy + */ + private String policy; + + /** + * be_member_date + */ + private String be_member_date; + + /** + * be_party_date + */ + private String be_party_date; + + /** + * islabouunion + */ + private String islabouunion; + + /** + * degree + */ + private String degree; + + /** + * health_info + */ + private String health_info; + + /** + * education_level + */ + private String education_level; + + /** + * height + */ + private String height; + + /** + * weight + */ + private Integer weight; + + /** + * use_kind + */ + private String use_kind; + + /** + * start_date + */ + private String start_date; + + /** + * end_date + */ + private String end_date; + + /** + * probation_end_date + */ + private String probation_end_date; + + /** + * resident_place + */ + private String resident_place; + + /** + * home_address + */ + private String home_address; + + /** + * temp_resident_number + */ + private String temp_resident_number; + + /** + * company_start_date + */ + private String company_start_date; + + /** + * work_start_date + */ + private String work_start_date; + + /** + * accum_fund_account + */ + private String accum_fund_account; + + /** + * account_name + */ + private String account_name; + + /** + * bank_id + */ + private String bank_id; + + /** + * account_id + */ + private String account_id; + + /** + * show_order + */ + private Integer show_order; + + /** + * classification + */ + private String classification; + + /** + * woprk_year + */ + private String work_year; + + /** + * company_work_year + */ + private String company_work_year; + + private String baseFieldsValue=""; + + private String baseFields=""; + + private Long creator; + private int deleteType; + private Date createTime; + private Date updateTime; +} diff --git a/src/com/engine/organization/entity/hrmresource/param/HrmResourceSearchParam.java b/src/com/engine/organization/entity/hrmresource/param/HrmResourceSearchParam.java index 5ac816b4..ecb2bc75 100644 --- a/src/com/engine/organization/entity/hrmresource/param/HrmResourceSearchParam.java +++ b/src/com/engine/organization/entity/hrmresource/param/HrmResourceSearchParam.java @@ -1,5 +1,6 @@ package com.engine.organization.entity.hrmresource.param; +import com.engine.organization.common.BaseQueryParam; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -14,7 +15,7 @@ import lombok.NoArgsConstructor; @Builder @AllArgsConstructor @NoArgsConstructor -public class HrmResourceSearchParam { +public class HrmResourceSearchParam extends BaseQueryParam { /** * 姓名 */ diff --git a/src/com/engine/organization/entity/hrmresource/po/HrmRelationPO.java b/src/com/engine/organization/entity/hrmresource/po/HrmRelationPO.java new file mode 100644 index 00000000..0e9c7899 --- /dev/null +++ b/src/com/engine/organization/entity/hrmresource/po/HrmRelationPO.java @@ -0,0 +1,75 @@ +package com.engine.organization.entity.hrmresource.po; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * @author:dxfeng + * @createTime: 2022/07/11 + * @version: 1.0 + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class HrmRelationPO { + /** + * 人员ID + */ + private Long id; + + /** + * 等级方案ID + */ + private Long schemeId; + + /** + * 职等ID + */ + private String levelId; + + /** + * 职级ID + */ + private Long gradeId; + + /** + * 岗位序列ID + */ + private Long sequenceId; + + /** + * 职务分类ID + */ + private Long postId; + + /** + * 职务信息ID + */ + private Long postInfoId; + + /** + * 分部ID + */ + private Long companyId; + + /** + * 部门ID + */ + private Long departmentId; + + /** + * 岗位ID + */ + private Long jobId; + + private Long creator; + private Integer deleteType; + private Date createTime; + private Date updateTime; + +} diff --git a/src/com/engine/organization/entity/hrmresource/po/HrmResourcePO.java b/src/com/engine/organization/entity/hrmresource/po/HrmResourcePO.java index 678f639a..3245bc2c 100644 --- a/src/com/engine/organization/entity/hrmresource/po/HrmResourcePO.java +++ b/src/com/engine/organization/entity/hrmresource/po/HrmResourcePO.java @@ -40,7 +40,7 @@ public class HrmResourcePO { /** * 性别 */ - private Integer sex; + private String sex; /** * 账号类型 @@ -75,7 +75,7 @@ public class HrmResourcePO { /** * 职称 */ - private Long jobCall; + private Integer jobCall; /** * 职级 @@ -120,12 +120,12 @@ public class HrmResourcePO { /** * 直接上级 */ - private Long managerId; + private Integer managerId; /** * 助理 */ - private Long assistantId; + private Integer assistantId; /** * 移动电话 @@ -161,4 +161,175 @@ public class HrmResourcePO { private int deleteType; private Date createTime; private Date updateTime; + + /** + * 密码 + */ + private String passWord; + + /** + * 安全级别 + */ + private Integer secLevel; + + /** + * 出生日期 + */ + private String birthday; + + /** + * 民族 + */ + private String folk; + + /** + * 籍贯 + */ + private String nativePlace; + + /** + * 户口 + */ + private String regResidentPlace; + + /** + * 身份证号码 + */ + private String certificateNum; + + /** + * 婚姻状况 + */ + private String maritalStatus; + + /** + * 政治面貌 + */ + private String policy; + + /** + * 入团日期 + */ + private String beMemberDate; + + /** + * 入党日期 + */ + private String bePartyDate; + + /** + * 工会会员 + */ + private String islabouunion; + + /** + * 学位 + */ + private String degree; + + /** + * 健康状况 + */ + private String healthInfo; + + /** + * 学历 + */ + private Integer educationLevel; + + /** + * 身高 + */ + private String height; + + /** + * 体重 + */ + private Integer weight; + + /** + * 用工性质 + */ + private Integer useKind; + + /** + * 合同开始日期 + */ + private String startDate; + + /** + * 合同结束日期 + */ + private String endDate; + + /** + * 试用期结束日期 + */ + private String probationEndDate; + + /** + * 现居住地 + */ + private String residentPlace; + + /** + * 家庭联系方式 + */ + private String homeAddress; + + /** + * 暂住证号码 + */ + private String tempResidentNumber; + + /** + * 入职日期 + */ + private String companyStartDate; + + /** + * 参加工作日期 + */ + private String workStartDate; + + /** + * 公积金帐户 + */ + private String accumFundAccount; + + /** + * 工资账号户名 + */ + private String accountName; + + /** + * 工资银行 + */ + private Integer bankId; + + /** + * 工资账号 + */ + private String accountId; + + /** + * 显示顺序 + */ + private Integer showOrder; + + /** + * 人员密级 + */ + private Integer classification; + + + private String workYear; + + + private String companyWorkYear; + + private String baseFieldsValue=""; + + private String baseFields=""; + } diff --git a/src/com/engine/organization/entity/hrmresource/vo/HrmResourceVO.java b/src/com/engine/organization/entity/hrmresource/vo/HrmResourceVO.java index a23c5e4e..40bbce2a 100644 --- a/src/com/engine/organization/entity/hrmresource/vo/HrmResourceVO.java +++ b/src/com/engine/organization/entity/hrmresource/vo/HrmResourceVO.java @@ -23,9 +23,11 @@ import lombok.NoArgsConstructor; "t.company_id," + "t.mobile," + "t.telephone," + - "t.manager_id ", + "t.manager_id, " + + "t.show_order ", fromSql = "FROM jcl_org_hrmresource t ", - orderby = " id ", + orderby = " show_order ", + sortway = " asc", primarykey = "id", operates = { @OrganizationTableOperate(index = "0", text = "发消息"), @@ -75,4 +77,7 @@ public class HrmResourceVO { */ @OrganizationTableColumn(text = "直接上级", width = "25%", column = "manager_id", transmethod = "com.engine.organization.transmethod.HrmResourceTransMethod.getManagerName") private String managerName; + + @OrganizationTableColumn(text = "显示顺序", width = "25%", column = "show_order", orderkey = "show_order") + private Integer showOrder; } diff --git a/src/com/engine/organization/entity/hrmresource/vo/ScHrmResourceVO.java b/src/com/engine/organization/entity/hrmresource/vo/ScHrmResourceVO.java new file mode 100644 index 00000000..e508f030 --- /dev/null +++ b/src/com/engine/organization/entity/hrmresource/vo/ScHrmResourceVO.java @@ -0,0 +1,85 @@ +package com.engine.organization.entity.hrmresource.vo; + +import com.cloudstore.eccom.pc.table.WeaTableType; +import com.engine.organization.annotation.OrganizationTable; +import com.engine.organization.annotation.OrganizationTableColumn; +import com.engine.organization.annotation.OrganizationTableOperate; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author:dxfeng + * @createTime: 2022/07/01 + * @version: 1.0 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@OrganizationTable(pageId = "2f2011f7-f915-11ec-8d51-00e04c680716", + fields = "t.id," + + "t.lastname," + + "t.departmentid," + + "t.subcompanyid1," + + "t.mobile," + + "t.telephone," + + "t.managerid, " + + "t.dsporder ", + fromSql = "FROM hrmresource t ", + orderby = " dsporder ", + sortway = " asc", + primarykey = "id", + operates = { + @OrganizationTableOperate(index = "0", text = "发消息"), + @OrganizationTableOperate(index = "1", text = "发送邮件"), + @OrganizationTableOperate(index = "1", text = "发送短信"), + @OrganizationTableOperate(index = "1", text = "新建日程"), + @OrganizationTableOperate(index = "1", text = "系统信息"), + }, + tableType = WeaTableType.CHECKBOX +) +public class ScHrmResourceVO { + /** + * 主键 + */ + @OrganizationTableColumn(column = "id", display = false) + private Long id; + + /** + * 姓名 + */ + @OrganizationTableColumn(text = "姓名", width = "25%", column = "lastname") + private String lastName; + /** + * 部门 + */ + @OrganizationTableColumn(text = "部门", width = "25%", column = "departmentid", transmethod = "com.engine.organization.transmethod.HrmResourceTransMethod.getScDepartmentName") + private String departmentName; + + /** + * 分部 + */ + @OrganizationTableColumn(text = "分部", width = "25%", column = "subcompanyid1", transmethod = "com.engine.organization.transmethod.HrmResourceTransMethod.getScCompanyName") + private String companyName; + + /** + * 移动电话 + */ + @OrganizationTableColumn(text = "移动电话", width = "25%", column = "mobile") + private String mobile; + /** + * 办公室电话 + */ + @OrganizationTableColumn(text = "办公室电话", width = "25%", column = "telephone") + private String telephone; + /** + * 直接上级 + */ + @OrganizationTableColumn(text = "直接上级", width = "25%", column = "managerid", transmethod = "com.engine.organization.transmethod.HrmResourceTransMethod.getScManagerName") + private String managerName; + + @OrganizationTableColumn(text = "显示顺序", width = "25%", column = "dsporder", orderkey = "dsporder") + private Integer showOrder; +} diff --git a/src/com/engine/organization/entity/job/dto/JobListDTO.java b/src/com/engine/organization/entity/job/dto/JobListDTO.java index 652e331d..a8f2b965 100644 --- a/src/com/engine/organization/entity/job/dto/JobListDTO.java +++ b/src/com/engine/organization/entity/job/dto/JobListDTO.java @@ -31,16 +31,16 @@ public class JobListDTO { * 是否被引用 */ private Integer isUsed; + /** + * 名称 + */ + @TableTitle(title = "名称", dataIndex = "jobName", key = "jobName",width = "150") + private String jobName; /** * 编号 */ @TableTitle(title = "编号", dataIndex = "jobNo", key = "jobNo") private String jobNo; - /** - * 名称 - */ - @TableTitle(title = "名称", dataIndex = "jobName", key = "jobName") - private String jobName; /** * 所属分部 */ diff --git a/src/com/engine/organization/entity/logview/bo/AbstractEquator.java b/src/com/engine/organization/entity/logview/bo/AbstractEquator.java new file mode 100644 index 00000000..215a834b --- /dev/null +++ b/src/com/engine/organization/entity/logview/bo/AbstractEquator.java @@ -0,0 +1,204 @@ +package com.engine.organization.entity.logview.bo; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * 对比器抽象类 + * + * @author:dxfeng + * @createTime: 2022/07/06 + * @version: 1.0 + */ +public abstract class AbstractEquator implements Equator { + private static final List> WRAPPER = Arrays.asList(Byte.class, Short.class, + Integer.class, Long.class, Float.class, Double.class, Character.class, + Boolean.class, String.class); + private List includeFields; + private List excludeFields; + /** + * 是否只比对两个类都包含的属性,若为 true 则比对两个类字段的次,否则比对两个类字段的并集 + *

+ * 只对要比对的两个对象为不同类型时有效 + *

+ * 默认为 true + */ + private boolean bothExistFieldOnly = true; + + public AbstractEquator() { + includeFields = Collections.emptyList(); + excludeFields = new ArrayList<>(); + excludeFields.add("creator"); + excludeFields.add("createTime"); + excludeFields.add("updateTime"); + excludeFields.add("deleteType"); + excludeFields.add("staffNum"); + } + + /** + * @param bothExistFieldOnly 是否只对比两个类都包含的字段 + */ + public AbstractEquator(boolean bothExistFieldOnly) { + includeFields = Collections.emptyList(); + excludeFields = Collections.emptyList(); + this.bothExistFieldOnly = bothExistFieldOnly; + } + + /** + * 指定包含或排除某些字段 + * + * @param includeFields 包含字段,若为 null 或空集,则不指定 + * @param excludeFields 排除字段,若为 null 或空集,则不指定 + */ + public AbstractEquator(List includeFields, List excludeFields) { + this.includeFields = includeFields; + this.excludeFields = excludeFields; + } + + /** + * 指定包含或排除某些字段 + * + * @param includeFields 包含字段,若为 null 或空集,则不指定 + * @param excludeFields 排除字段,若为 null 或空集,则不指定 + * @param bothExistFieldOnly 是否只对比两个类都包含的字段,默认为 true + */ + public AbstractEquator(List includeFields, List excludeFields, boolean bothExistFieldOnly) { + this.includeFields = includeFields; + this.excludeFields = excludeFields; + this.bothExistFieldOnly = bothExistFieldOnly; + } + + /** + * 只要没有不相等的属性,两个对象就全相等 + * + * @param first 对象1 + * @param second 对象2 + * @return 两个对象是否全相等 + */ + @Override + public boolean isEquals(Object first, Object second) { + List diff = getDiffFields(first, second); + return diff == null || diff.isEmpty(); + } + + /** + * 对比两个对象的指定属性是否相等,默认为两个对象是否 equals + *

+ * 子类可以通过覆盖此方法对某些特殊属性进行比对 + * + * @param fieldInfo 当前比对属性信息 + * @return 属性是否相等 + */ + protected boolean isFieldEquals(FieldInfo fieldInfo) { + // 先判断排除,如果需要排除,则无论在不在包含范围,都一律不比对 + if (isExclude(fieldInfo)) { + return true; + } + // 如果有指定需要包含的字段而且当前字段不在需要包含的字段中则不比对 + if (!isInclude(fieldInfo)) { + return true; + } + return nullableEquals(fieldInfo.getFirstVal(), fieldInfo.getSecondVal()); + } + + /** + * 确定是否需要比较这个字段,子类可以扩展这个方法,自定义判断方式 + */ + protected boolean isInclude(FieldInfo fieldInfo) { + // 没有指定需要包含的字段,则全部都包含 + if (includeFields == null || includeFields.isEmpty()) { + return true; + } + return includeFields.contains(fieldInfo.getFieldName()); + } + + /** + * 确定是否需要需要排除这个字段,子类可以扩展这个方法,自定义判断方式 + */ + protected boolean isExclude(FieldInfo fieldInfo) { + // 如果有指定需要排除的字段,而且当前字段是需要排除字段,则直接返回 true + return excludeFields != null && !excludeFields.isEmpty() && excludeFields.contains(fieldInfo.getFieldName()); + } + + /** + * 如果简单数据类型的对象则直接进行比对 + * + * @param first 对象1 + * @param second 对象2 + * @return 不同的字段信息,相等返回空集,不等则 FieldInfo 的字段名为对象的类型名称 + */ + List compareSimpleField(Object first, Object second) { + boolean eq = Objects.equals(first, second); + if (eq) { + return Collections.emptyList(); + } else { + Object obj = first == null ? second : first; + Class clazz = obj.getClass(); + // 不等的字段名称使用类的名称 + + return Collections.singletonList("[" + clazz.getSimpleName() + "]:由" + first + "修改为" + second); + } + } + + /** + * 判断是否为原始数据类型 + * + * @param first 对象1 + * @param second 对象2 + * @return 是否为原始数据类型 + */ + boolean isSimpleField(Object first, Object second) { + Object obj = first == null ? second : first; + Class clazz = obj.getClass(); + return clazz.isPrimitive() || WRAPPER.contains(clazz); + } + + /** + * 根据配置的规则决定取两个对象字段的交集或并集 + */ + Set getAllFieldNames(Set firstFields, Set secondFields) { + Set allFields; + // 只取交集 + if (isBothExistFieldOnly()) { + allFields = firstFields.stream().filter(secondFields::contains).collect(Collectors.toSet()); + } else { + // 否则取并集 + allFields = new HashSet<>(firstFields); + allFields.addAll(secondFields); + } + return allFields; + } + + private boolean nullableEquals(Object first, Object second) { + if (first instanceof Collection + && second instanceof Collection) { + // 如果两个都是集合类型,尝试转换为数组再进行深度比较 + return Objects.deepEquals(((Collection) first).toArray(), ((Collection) second).toArray()); + } + return Objects.deepEquals(first, second); + } + + public void setIncludeFields(List includeFields) { + this.includeFields = includeFields; + } + + public void setExcludeFields(List excludeFields) { + this.excludeFields = excludeFields; + } + + public void setBothExistFieldOnly(boolean bothExistFieldOnly) { + this.bothExistFieldOnly = bothExistFieldOnly; + } + + public List getIncludeFields() { + return includeFields; + } + + public List getExcludeFields() { + return excludeFields; + } + + public boolean isBothExistFieldOnly() { + return bothExistFieldOnly; + } +} diff --git a/src/com/engine/organization/entity/logview/bo/Equator.java b/src/com/engine/organization/entity/logview/bo/Equator.java new file mode 100644 index 00000000..5b01d5b0 --- /dev/null +++ b/src/com/engine/organization/entity/logview/bo/Equator.java @@ -0,0 +1,31 @@ +package com.engine.organization.entity.logview.bo; + +import java.util.List; + + +/** + * 对象比对器,用于对比两个对象的所有属性是否完全相等 + * + * @author:dxfeng + * @createTime: 2022/07/06 + * @version: 1.0 + */ +public interface Equator { + /** + * 两个对象是否全相等 + * + * @param first 对象1 + * @param second 对象2 + * @return 两个对象是否全相等 + */ + boolean isEquals(Object first, Object second); + + /** + * 获取不相等的属性 + * + * @param first 对象1 + * @param second 对象2 + * @return 不相等的属性,键为属性名,值为属性类型 + */ + List getDiffFields(Object first, Object second); +} diff --git a/src/com/engine/organization/entity/logview/bo/FieldBaseEquator.java b/src/com/engine/organization/entity/logview/bo/FieldBaseEquator.java new file mode 100644 index 00000000..5248c974 --- /dev/null +++ b/src/com/engine/organization/entity/logview/bo/FieldBaseEquator.java @@ -0,0 +1,133 @@ +package com.engine.organization.entity.logview.bo; + +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Field; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; + +/** + * 基于属性的比对器 + * + * @author:dxfeng + * @createTime: 2022/07/06 + * @version: 1.0 + */ +public class FieldBaseEquator extends AbstractEquator { + private static final Map, Map> CACHE = new ConcurrentHashMap<>(); + + // 忽略 + private List ignoreFields = new ArrayList<>(); + + public FieldBaseEquator() { + } + + public FieldBaseEquator(boolean bothExistFieldOnly) { + super(bothExistFieldOnly); + } + + public FieldBaseEquator(List includeFields, List excludeFields, boolean bothExistFieldOnly) { + super(includeFields, excludeFields, bothExistFieldOnly); + } + + /** + * 指定包含或排除某些字段 + * + * @param includeFields 包含字段,若为 null 或空集,则不指定 + * @param excludeFields 排除字段,若为 null 或空集,则不指定 + */ + public FieldBaseEquator(List includeFields, List excludeFields) { + super(includeFields, excludeFields); + } + + /** + * {@inheritDoc} + */ + @Override + public List getDiffFields(Object first, Object second) { + if (first == second) { + return Collections.emptyList(); + } + // 先尝试判断是否为简单数据类型 + if (isSimpleField(first, second)) { + return compareSimpleField(first, second); + } + Set allFieldNames; + // 获取所有字段 + Map firstFields = getAllFields(first); + Map secondFields = getAllFields(second); + if (first == null) { + allFieldNames = secondFields.keySet(); + } else if (second == null) { + allFieldNames = firstFields.keySet(); + } else { + allFieldNames = getAllFieldNames(firstFields.keySet(), secondFields.keySet()); + } + List diffFields = new LinkedList<>(); + for (String fieldName : allFieldNames) { + try { + Field firstField = firstFields.getOrDefault(fieldName, null); + Field secondField = secondFields.getOrDefault(fieldName, null); + Object firstVal = null; + Class firstType = null; + Class secondType = null; + Object secondVal = null; + if (firstField != null) { + firstField.setAccessible(true); + firstVal = firstField.get(first); + firstType = firstField.getType(); + } + if (secondField != null) { + secondField.setAccessible(true); + secondVal = secondField.get(second); + secondType = secondField.getType(); + } + FieldInfo fieldInfo = new FieldInfo(fieldName, firstType, secondType); + fieldInfo.setFirstVal(firstVal); + fieldInfo.setSecondVal(secondVal); + if (!isFieldEquals(fieldInfo) && isNoneEmpty(firstVal, secondVal)) { + diffFields.add("[" + fieldName + "]:由\"" + firstVal + "\"修改为\"" + secondVal + "\""); + } + } catch (IllegalAccessException e) { + throw new IllegalStateException("获取属性进行比对发生异常: " + fieldName, e); + } + } + return diffFields; + } + + private Map getAllFields(Object obj) { + if (obj == null) { + return Collections.emptyMap(); + } + return CACHE.computeIfAbsent(obj.getClass(), k -> { + Map fieldMap = new HashMap<>(8); + Class cls = k; + while (cls != Object.class) { + Field[] fields = cls.getDeclaredFields(); + for (Field field : fields) { + // 一些通过字节码注入改写类的框架会合成一些字段,如 jacoco 的 $jacocoData 字段 + // 正常情况下这些字段都需要被排除掉 + if (!field.isSynthetic()) { + fieldMap.put(field.getName(), field); + } + } + cls = cls.getSuperclass(); + } + return fieldMap; + }); + } + + + /** + * 判断是否为”“与null之间的转换 + * + * @param firstVal + * @param secondVal + * @return + */ + private boolean isNoneEmpty(Object firstVal, Object secondVal) { + String first = null == firstVal ? "" : firstVal.toString(); + String second = null == secondVal ? "" : secondVal.toString(); + return !StringUtils.isAllBlank(first, second); + } +} diff --git a/src/com/engine/organization/entity/logview/bo/FieldInfo.java b/src/com/engine/organization/entity/logview/bo/FieldInfo.java new file mode 100644 index 00000000..11a9f68b --- /dev/null +++ b/src/com/engine/organization/entity/logview/bo/FieldInfo.java @@ -0,0 +1,120 @@ +package com.engine.organization.entity.logview.bo; + +import java.util.Objects; + +/** + * 不同的属性 + * + * @author:dxfeng + * @createTime: 2022/07/06 + * @version: 1.0 + */ +public class FieldInfo { + /** + * 字段名称 + */ + private String fieldName; + /** + * 第一个字段的类型 + */ + private Class firstFieldType; + /** + * 第二个字段的类型 + */ + private Class secondFieldType; + /** + * 第一个对象的值 + */ + private Object firstVal; + /** + * 第二个对象的值 + */ + private Object secondVal; + + public FieldInfo() { + } + + public FieldInfo(String fieldName, Class firstFieldType, Class secondFieldType) { + this.fieldName = fieldName; + this.firstFieldType = firstFieldType; + this.secondFieldType = secondFieldType; + } + + public FieldInfo(String fieldName, Class fieldType, Object firstVal, Object secondVal) { + this.fieldName = fieldName; + this.firstFieldType = fieldType; + this.secondFieldType = fieldType; + this.firstVal = firstVal; + this.secondVal = secondVal; + } + + public FieldInfo(String fieldName, Class firstFieldType, Class secondFieldType, Object firstVal, Object secondVal) { + this.fieldName = fieldName; + this.firstFieldType = firstFieldType; + this.secondFieldType = secondFieldType; + this.firstVal = firstVal; + this.secondVal = secondVal; + } + + public String getFieldName() { + return fieldName; + } + + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } + + public Class getFirstFieldType() { + return firstFieldType; + } + + public void setFirstFieldType(Class firstFieldType) { + this.firstFieldType = firstFieldType; + } + + public Object getFirstVal() { + return firstVal; + } + + public void setFirstVal(Object firstVal) { + this.firstVal = firstVal; + } + + public void setSecondFieldType(Class secondFieldType) { + this.secondFieldType = secondFieldType; + } + + public Class getSecondFieldType() { + return secondFieldType; + } + + public Object getSecondVal() { + return secondVal; + } + + public void setSecondVal(Object secondVal) { + this.secondVal = secondVal; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + FieldInfo fieldInfo = (FieldInfo) o; + return Objects.equals(fieldName, fieldInfo.fieldName) && + Objects.equals(firstFieldType, fieldInfo.firstFieldType) && + Objects.equals(secondFieldType, fieldInfo.secondFieldType) && + Objects.equals(firstVal, fieldInfo.firstVal) && + Objects.equals(secondVal, fieldInfo.secondVal); + } + + @Override + public int hashCode() { + return Objects.hash(fieldName, firstFieldType, secondFieldType, firstVal, secondVal); + } + + @Override + public String toString() { + return "[\"" + fieldName + "\":由\"" + firstVal + "\"修改为\"" + secondVal; + } +} diff --git a/src/com/engine/organization/entity/logview/bo/GetterBaseEquator.java b/src/com/engine/organization/entity/logview/bo/GetterBaseEquator.java new file mode 100644 index 00000000..a1274d16 --- /dev/null +++ b/src/com/engine/organization/entity/logview/bo/GetterBaseEquator.java @@ -0,0 +1,168 @@ +package com.engine.organization.entity.logview.bo; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; + +/** + * 基于 getter 方法比对两个对象 + *

+ * 所有无参的 get 和 is 方法都认为是对象的属性 + *

+ * + * @author:dxfeng + * @createTime: 2022/07/06 + * @version: 1.0 + */ +public class GetterBaseEquator extends AbstractEquator { + private static final String GET = "get"; + private static final String IS = "is"; + private static final String GET_IS = "get|is"; + private static final String GET_CLASS = "getClass"; + private static final Map, Map> CACHE = new ConcurrentHashMap<>(); + + public GetterBaseEquator() { + } + + /** + * @param bothExistFieldOnly 是否只对比两个类都包含的字段 + */ + public GetterBaseEquator(boolean bothExistFieldOnly) { + super(bothExistFieldOnly); + } + + /** + * 指定包含或排除某些字段 + * + * @param includeFields 包含字段,若为 null 或空集,则不指定 + * @param excludeFields 排除字段,若为 null 或空集,则不指定 + */ + public GetterBaseEquator(List includeFields, List excludeFields) { + super(includeFields, excludeFields); + } + + /** + * 指定包含或排除某些字段 + * + * @param includeFields 包含字段,若为 null 或空集,则不指定 + * @param excludeFields 排除字段,若为 null 或空集,则不指定 + * @param bothExistFieldOnly 是否只对比两个类都包含的字段,默认为 true + */ + public GetterBaseEquator(List includeFields, List excludeFields, boolean bothExistFieldOnly) { + super(includeFields, excludeFields, bothExistFieldOnly); + } + + /** + * {@inheritDoc} + */ + @Override + public List getDiffFields(Object first, Object second) { + if (first == null && second == null) { + return Collections.emptyList(); + } + // 先尝试判断是否为普通数据类型 + if (isSimpleField(first, second)) { + return compareSimpleField(first, second); + } + Set allFieldNames; + // 获取所有字段 + Map firstGetters = getAllGetters(first); + Map secondGetters = getAllGetters(second); + if (first == null) { + allFieldNames = secondGetters.keySet(); + } else if (second == null) { + allFieldNames = firstGetters.keySet(); + } else { + allFieldNames = getAllFieldNames(firstGetters.keySet(), secondGetters.keySet()); + } + List diffFields = new LinkedList<>(); + for (String fieldName : allFieldNames) { + try { + Method firstGetterMethod = firstGetters.getOrDefault(fieldName, null); + Method secondGetterMethod = secondGetters.getOrDefault(fieldName, null); + Object firstVal = firstGetterMethod != null ? firstGetterMethod.invoke(first) : null; + Object secondVal = secondGetterMethod != null ? secondGetterMethod.invoke(second) : null; + FieldInfo fieldInfo = new FieldInfo(fieldName, getReturnType(firstGetterMethod), getReturnType(secondGetterMethod)); + fieldInfo.setFirstVal(firstVal); + fieldInfo.setSecondVal(secondVal); + if (!isFieldEquals(fieldInfo)) { + diffFields.add("[" + fieldName + "]:由" + firstVal + "修改为" + secondVal); + } + } catch (IllegalAccessException | InvocationTargetException e) { + throw new IllegalStateException("获取属性进行比对发生异常: " + fieldName, e); + } + } + return diffFields; + } + + private Class getReturnType(Method method) { + return method == null ? null : method.getReturnType(); + } + + /** + * 获取类中的所有 getter 方法 + * + * @return key -> fieldName, value -> getter + */ + private Map getAllGetters(Object obj) { + if (obj == null) { + return Collections.emptyMap(); + } + return CACHE.computeIfAbsent(obj.getClass(), k -> { + Class clazz = obj.getClass(); + Map getters = new LinkedHashMap<>(8); + while (clazz != Object.class) { + Method[] methods = clazz.getDeclaredMethods(); + for (Method m : methods) { + // getter 方法必须是 public 且没有参数的 + if (!Modifier.isPublic(m.getModifiers()) || m.getParameterTypes().length > 0) { + continue; + } + if (m.getReturnType() == Boolean.class || m.getReturnType() == boolean.class) { + // 如果返回值是 boolean 则兼容 isXxx 的写法 + if (m.getName().startsWith(IS)) { + String fieldName = uncapitalize(m.getName().substring(2)); + getters.put(fieldName, m); + continue; + } + } + // 以get开头但排除getClass()方法 + if (m.getName().startsWith(GET) && !GET_CLASS.equals(m.getName())) { + String fieldName = uncapitalize(m.getName().replaceFirst(GET_IS, "")); + getters.put(fieldName, m); + } + } + clazz = clazz.getSuperclass(); //得到父类,然后赋给自己 + } + return getters; + }); + } + + /** + * 来自commons-lang3包的StringUtils + *

+ * 用于使首字母小写 + */ + private String uncapitalize(final String str) { + int strLen; + if (str == null || (strLen = str.length()) == 0) { + return str; + } + final int firstCodepoint = str.codePointAt(0); + final int newCodePoint = Character.toLowerCase(firstCodepoint); + if (firstCodepoint == newCodePoint) { + return str; + } + final int[] newCodePoints = new int[strLen]; + int outOffset = 0; + newCodePoints[outOffset++] = newCodePoint; + for (int inOffset = Character.charCount(firstCodepoint); inOffset < strLen; ) { + final int codepoint = str.codePointAt(inOffset); + newCodePoints[outOffset++] = codepoint; + inOffset += Character.charCount(codepoint); + } + return new String(newCodePoints, 0, outOffset); + } +} diff --git a/src/com/engine/organization/entity/logview/param/LogViewSearchParam.java b/src/com/engine/organization/entity/logview/param/LogViewSearchParam.java new file mode 100644 index 00000000..7e031d86 --- /dev/null +++ b/src/com/engine/organization/entity/logview/param/LogViewSearchParam.java @@ -0,0 +1,25 @@ +package com.engine.organization.entity.logview.param; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author:dxfeng + * @createTime: 2022/07/05 + * @version: 1.0 + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class LogViewSearchParam { + private Long operatorId; + private Long companyId; + private Long departmentId; + private String operateDate; + private String startDate; + private String endDate; + private String moduleType; +} diff --git a/src/com/engine/organization/entity/logview/vo/LogViewVO.java b/src/com/engine/organization/entity/logview/vo/LogViewVO.java new file mode 100644 index 00000000..3882430a --- /dev/null +++ b/src/com/engine/organization/entity/logview/vo/LogViewVO.java @@ -0,0 +1,57 @@ +package com.engine.organization.entity.logview.vo; + +import com.cloudstore.eccom.pc.table.WeaTableType; +import com.engine.organization.annotation.*; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * @author:dxfeng + * @createTime: 2022/07/05 + * @version: 1.0 + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@OrganizationTable(pageId = "caef4d3e-fc3d-11ec-a203-00e04c680716", + fields = "t.id, t.operator_name, t.create_time, t.operate_type, t.client_ip, t.operate_module_name,t.operate_desc,t.message,t.value,t.params_str", + fromSql = "FROM hr_log t ", + primarykey = "id", + orderby = "create_time", + tableType = WeaTableType.NONE +) +public class LogViewVO { + + @OrganizationTableColumn(text = "操作时间", width = "20%", column = "create_time", transmethod = "com.engine.organization.transmethod.LogViewTransMethod.getDateTimeFormat") + private Date createTime; + + @OrganizationTableColumn(text = "操作者", width = "16%", column = "operator_name") + private String operator; + + @OrganizationTableColumn(text = "操作类型", width = "16%", column = "operate_type", transmethod = "com.engine.organization.transmethod.LogViewTransMethod.getOperateType") + private String operateType; + + @OrganizationTableColumn(text = "操作描述", width = "16%", column = "operate_desc") + private String operateDesc; + + @OrganizationTableColumn(text = "对象", width = "16%", column = "value") + private String value; + + @OrganizationTableColumn(text = "所属模块", width = "16%", column = "operate_module_name") + private String operateModuleName; + + @OrganizationTableColumn(text = "修改详情", width = "16%", column = "message") + private String showDetail; + + @OrganizationTableColumn(text = "操作IP", width = "16%", column = "client_ip") + private String clientIp; + + @OrganizationTableColumn(text = "操作参数", width = "16%", column = "params_str", display = false) + private String paramsStr; + +} diff --git a/src/com/engine/organization/entity/postion/param/PostInfoSearchParam.java b/src/com/engine/organization/entity/postion/param/PostInfoSearchParam.java index 93de6af8..be9ffe5c 100644 --- a/src/com/engine/organization/entity/postion/param/PostInfoSearchParam.java +++ b/src/com/engine/organization/entity/postion/param/PostInfoSearchParam.java @@ -43,7 +43,7 @@ public class PostInfoSearchParam { /** * 职务分类 */ - private Integer postId; + private Long postId; /** * 说明 */ diff --git a/src/com/engine/organization/entity/postion/po/PostInfoPO.java b/src/com/engine/organization/entity/postion/po/PostInfoPO.java index 6fdcf20e..ee1290c0 100644 --- a/src/com/engine/organization/entity/postion/po/PostInfoPO.java +++ b/src/com/engine/organization/entity/postion/po/PostInfoPO.java @@ -45,7 +45,7 @@ public class PostInfoPO { /** * 职务分类 */ - private Integer postId; + private Long postId; /** * 说明 */ diff --git a/src/com/engine/organization/enums/LogModuleNameEnum.java b/src/com/engine/organization/enums/LogModuleNameEnum.java new file mode 100644 index 00000000..7779b220 --- /dev/null +++ b/src/com/engine/organization/enums/LogModuleNameEnum.java @@ -0,0 +1,39 @@ +package com.engine.organization.enums; + +/** + * @author:dxfeng + * @createTime: 2022/07/04 + * @version: 1.0 + */ +public enum LogModuleNameEnum { + SCHEME("等级方案", 1), + LEVEL("职等", 2), + GRADE("职级", 3), + SEQUENCE("岗位序列", 4), + POSTINFO("职务管理", 6), + GROUP("集团管理", 7), + COMPANY("分部管理", 8), + DEPARTMENT("部门管理", 9), + JOB("岗位管理", 10), + RESOURCE("人员管理", 11), + STAFFPLAN("编制方案", 12), + STAFF("编制上报", 13), + OTHER("其他模块", 99); + + private String name; + + private Integer value; + + LogModuleNameEnum(String name, Integer value) { + this.name = name; + this.value = value; + } + + public Integer getValue() { + return value; + } + + public String getName() { + return name; + } +} diff --git a/src/com/engine/organization/enums/OperateTypeEnum.java b/src/com/engine/organization/enums/OperateTypeEnum.java index f4d4c4fa..1d2c8952 100644 --- a/src/com/engine/organization/enums/OperateTypeEnum.java +++ b/src/com/engine/organization/enums/OperateTypeEnum.java @@ -10,7 +10,10 @@ public enum OperateTypeEnum { ADD("1", "新增"), UPDATE("2", "更新"), - DELETE("4", "删除"); + DELETE("4", "删除"), + MOVE("5", "转移"), + MERGE("6", "合并"), + COPY("7", "复制"); private String value; diff --git a/src/com/engine/organization/mapper/comp/CompMapper.java b/src/com/engine/organization/mapper/comp/CompMapper.java index 8f10abcc..ff119d78 100644 --- a/src/com/engine/organization/mapper/comp/CompMapper.java +++ b/src/com/engine/organization/mapper/comp/CompMapper.java @@ -28,6 +28,8 @@ public interface CompMapper { */ List listUsedId(); + List listUsedIds(); + /** * 根据搜索条件查询数据 * @@ -140,4 +142,22 @@ public interface CompMapper { * @return */ int getMaxShowOrder(); + + /** + * 根据名称和上级查找ID + * + * @param companyName + * @param parentCompany + * @return + */ + Long getIdByNameAndPid(@Param("companyName") String companyName, @Param("parentCompany") Long parentCompany); + + /** + * 统计顶层分部个数 + * + * @param parentCompany + * @return + */ + Integer countTopCompany(@Param("parentCompany") Long parentCompany); + } diff --git a/src/com/engine/organization/mapper/comp/CompMapper.xml b/src/com/engine/organization/mapper/comp/CompMapper.xml index d22ac668..8a119700 100644 --- a/src/com/engine/organization/mapper/comp/CompMapper.xml +++ b/src/com/engine/organization/mapper/comp/CompMapper.xml @@ -52,6 +52,21 @@ and NVL(parent_company,'0')='0' + + and ifnull(parent_company,0) = + #{parentCompany} + + + + and isnull(parent_company,0) = + #{parentCompany} + + + + and NVL(parent_company,0) = + #{parentCompany} + + INSERT INTO jcl_org_comp @@ -135,7 +150,9 @@ #{description}, 0, - #{showOrder}, + + #{showOrder}, + @@ -249,10 +266,6 @@ from JCL_ORG_JOB where delete_type = 0 union - select company_id - from JCL_ORG_STAFFPLAN - where delete_type = 0 - union select comp_id from JCL_ORG_STAFF where delete_type = 0 @@ -261,6 +274,21 @@ select max(show_order) from jcl_org_comp + + + update jcl_org_comp diff --git a/src/com/engine/organization/mapper/department/DepartmentMapper.java b/src/com/engine/organization/mapper/department/DepartmentMapper.java index 8445ee0e..6b4c470c 100644 --- a/src/com/engine/organization/mapper/department/DepartmentMapper.java +++ b/src/com/engine/organization/mapper/department/DepartmentMapper.java @@ -114,4 +114,13 @@ public interface DepartmentMapper { * @return */ int getMaxShowOrder(); + + /** + * 根据名称、上级 查询部门元素 + * @param departmentName + * @param parentCompany + * @param parentDepartment + * @return + */ + Long getIdByNameAndPid(@Param("departmentName") String departmentName, @Param("parentCompany") Long parentCompany, @Param("parentDepartment") Long parentDepartment); } diff --git a/src/com/engine/organization/mapper/department/DepartmentMapper.xml b/src/com/engine/organization/mapper/department/DepartmentMapper.xml index ea6e20ed..d316c68e 100644 --- a/src/com/engine/organization/mapper/department/DepartmentMapper.xml +++ b/src/com/engine/organization/mapper/department/DepartmentMapper.xml @@ -140,6 +140,27 @@ select max(show_order) from jcl_org_dept + + + and ifnull(parent_dept,0) = + #{parentDepartment} + + + + and isnull(parent_dept,0) = + #{parentDepartment} + + + + and NVL(parent_dept,0) = + #{parentDepartment} + + + + + + + + + + + + + + + + + + + + + + + + t + . + id + , t.scheme_id + , t.level_id + , t.grade_id + , t.sequence_id + , t.post_id + , t.post_info_id + , t.company_id + , t.department_id + , t.job_id + , t.creator + , t.delete_type + , t.create_time + , t.update_time + + + INSERT INTO jcl_org_hrmrelation + + + creator, + + + delete_type, + + + create_time, + + + update_time, + + + id, + + + scheme_id, + + + level_id, + + + grade_id, + + + sequence_id, + + + post_id, + + + post_info_id, + + + company_id, + + + department_id, + + + job_id, + + + + + #{creator}, + + + #{deleteType}, + + + #{createTime}, + + + #{updateTime}, + + + #{id}, + + + #{schemeId}, + + + #{levelId}, + + + #{gradeId}, + + + #{sequenceId}, + + + #{postId}, + + + #{postInfoId}, + + + #{companyId}, + + + #{departmentId}, + + + #{jobId}, + + + + + update jcl_org_hrmrelation + + update_time=#{updateTime}, + scheme_id=#{schemeId}, + level_id=#{levelId}, + grade_id=#{gradeId}, + sequence_id=#{sequenceId}, + post_id=#{postId}, + post_info_id=#{postInfoId}, + company_id=#{companyId}, + department_id=#{departmentId}, + job_id=#{jobId}, + + WHERE id = #{id} AND delete_type = 0 + + + + + \ No newline at end of file diff --git a/src/com/engine/organization/mapper/hrmresource/HrmResourceMapper.java b/src/com/engine/organization/mapper/hrmresource/HrmResourceMapper.java new file mode 100644 index 00000000..b6712f5e --- /dev/null +++ b/src/com/engine/organization/mapper/hrmresource/HrmResourceMapper.java @@ -0,0 +1,47 @@ +package com.engine.organization.mapper.hrmresource; + +import com.alibaba.fastjson.JSONObject; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @description: + * @author:dxfeng + * @createTime: 2022/05/20 + * @version: 1.0 + */ +public interface HrmResourceMapper { + + /** + * 获取最大ID + * + * @return + */ + Long getMaxId(); + + /** + * 根据ID查询姓名 + * + * @param id + * @return + */ + String getLastNameById(@Param("id") Long id); + + /** + * 根据所选关键字段查询ID + * + * @param keyField + * @param keyFieldValue + * @return + */ + Integer getIdByKeyField(@Param("keyField") String keyField, @Param("keyFieldValue") String keyFieldValue); + + /** + * 根据所选关键字段,查询关键列 + * + * @param keyField + * @return + */ + List getKeyMapByKetField(@Param("keyField") String keyField); +} diff --git a/src/com/engine/organization/mapper/hrmresource/HrmResourceMapper.xml b/src/com/engine/organization/mapper/hrmresource/HrmResourceMapper.xml new file mode 100644 index 00000000..f96be2e4 --- /dev/null +++ b/src/com/engine/organization/mapper/hrmresource/HrmResourceMapper.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + t + . + id + , t.creator + , t.delete_type + , t.create_time + , t.update_time + + + + + + + + \ No newline at end of file diff --git a/src/com/engine/organization/mapper/hrmresource/SystemDataMapper.java b/src/com/engine/organization/mapper/hrmresource/SystemDataMapper.java new file mode 100644 index 00000000..7031517e --- /dev/null +++ b/src/com/engine/organization/mapper/hrmresource/SystemDataMapper.java @@ -0,0 +1,33 @@ +package com.engine.organization.mapper.hrmresource; + + +import com.alibaba.fastjson.JSONObject; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @author:dxfeng + * @createTime: 2022/06/30 + * @version: 1.0 + */ +public interface SystemDataMapper { + + JSONObject getSysLanguageByLicense(); + + List getSysLanguageByActivable(); + + List getHrmEducationLevelData(); + + List getHrmJobCallData(); + + List getHrmLocationsByCountryId(); + + List getHrmUseKindData(); + + String getScCompanyNameById(@Param("companyId") String companyId); + + String getScDepartmentNameById(@Param("departmentId") String departmentId); + + String getScHrmResourceNameById(@Param("managerId") String managerId); +} diff --git a/src/com/engine/organization/mapper/hrmresource/SystemDataMapper.xml b/src/com/engine/organization/mapper/hrmresource/SystemDataMapper.xml new file mode 100644 index 00000000..75014d9d --- /dev/null +++ b/src/com/engine/organization/mapper/hrmresource/SystemDataMapper.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/com/engine/organization/mapper/job/JobMapper.java b/src/com/engine/organization/mapper/job/JobMapper.java index 059548f3..7a93dad0 100644 --- a/src/com/engine/organization/mapper/job/JobMapper.java +++ b/src/com/engine/organization/mapper/job/JobMapper.java @@ -53,6 +53,8 @@ public interface JobMapper { */ JobPO getJobById(@Param("id") Long id); + List getJobsByIds(@Param("ids") Collection ids); + /** * 根据父ID查询元素 * @@ -131,4 +133,15 @@ public interface JobMapper { * @return */ int getMaxShowOrder(); + + /** + * 根据名字和上级查询岗位信息 + * + * @param jobName + * @param parentCompany + * @param parentDepartment + * @param parentJob + * @return + */ + Long getIdByNameAndPid(@Param("jobName") String jobName, @Param("parentCompany") Long parentCompany, @Param("parentDepartment") Long parentDepartment, @Param("parentJob") Long parentJob); } diff --git a/src/com/engine/organization/mapper/job/JobMapper.xml b/src/com/engine/organization/mapper/job/JobMapper.xml index d6956616..5ed38b6e 100644 --- a/src/com/engine/organization/mapper/job/JobMapper.xml +++ b/src/com/engine/organization/mapper/job/JobMapper.xml @@ -337,6 +337,39 @@ select max(show_order) from jcl_org_job + + + + + and ifnull(parent_job,0) = + #{parentJob} + + + + and isnull(parent_job,0) = + #{parentJob} + + + + and NVL(parent_job,0) = + #{parentJob} + diff --git a/src/com/engine/organization/mapper/post/PostInfoMapper.java b/src/com/engine/organization/mapper/post/PostInfoMapper.java index 9beeb3f8..10a55536 100644 --- a/src/com/engine/organization/mapper/post/PostInfoMapper.java +++ b/src/com/engine/organization/mapper/post/PostInfoMapper.java @@ -25,8 +25,11 @@ public interface PostInfoMapper { */ List listByNo(@Param("postInfoNo") String postInfoNo); + PostInfoPO getPostInfoByNameAndPostId(@Param("postInfoName") String postInfoName, @Param("postId") Long postId); + /** * 获取职务信息根据ID + * * @param id * @return */ @@ -39,10 +42,11 @@ public interface PostInfoMapper { * @return */ @MapKey("id") - List> listPostInfosByIds(@Param("ids") Collection ids); + List> listPostInfosByIds(@Param("ids") Collection ids); /** * 插入职务信息 + * * @param postInfoPO * @return */ @@ -63,6 +67,7 @@ public interface PostInfoMapper { * @return */ int updateForbiddenTagById(PostInfoPO postInfoPO); + /** * 批量删除职务信息方案 * @@ -71,4 +76,5 @@ public interface PostInfoMapper { int deleteByIds(@Param("ids") Collection ids); + List getPostInfosByIds(@Param("ids") Collection ids); } diff --git a/src/com/engine/organization/mapper/post/PostInfoMapper.xml b/src/com/engine/organization/mapper/post/PostInfoMapper.xml index 10d12bf9..7781a8ea 100644 --- a/src/com/engine/organization/mapper/post/PostInfoMapper.xml +++ b/src/com/engine/organization/mapper/post/PostInfoMapper.xml @@ -60,6 +60,20 @@ #{id} + + update jcl_org_post_info diff --git a/src/com/engine/organization/mapper/post/PostMapper.java b/src/com/engine/organization/mapper/post/PostMapper.java index db7ab1a0..ad3bd827 100644 --- a/src/com/engine/organization/mapper/post/PostMapper.java +++ b/src/com/engine/organization/mapper/post/PostMapper.java @@ -26,6 +26,8 @@ public interface PostMapper { */ PostPO getPostByID(@Param("id") long id); + List listByName(@Param("postName") String postName); + /** * 根据ID查询职务分类列表 * 浏览按钮赋值、展示用 @@ -65,4 +67,5 @@ public interface PostMapper { */ int deleteByIds(@Param("ids") Collection ids); + List getPostsByIds(@Param("ids") Collection ids); } diff --git a/src/com/engine/organization/mapper/post/PostMapper.xml b/src/com/engine/organization/mapper/post/PostMapper.xml index df766b4b..2ab3c223 100644 --- a/src/com/engine/organization/mapper/post/PostMapper.xml +++ b/src/com/engine/organization/mapper/post/PostMapper.xml @@ -49,7 +49,24 @@ + + @@ -109,7 +126,6 @@ - UPDATE jcl_org_post SET delete_type = 1 diff --git a/src/com/engine/organization/mapper/resource/ResourceMapper.java b/src/com/engine/organization/mapper/resource/ResourceMapper.java new file mode 100644 index 00000000..fd8f1e31 --- /dev/null +++ b/src/com/engine/organization/mapper/resource/ResourceMapper.java @@ -0,0 +1,18 @@ +package com.engine.organization.mapper.resource; + + +import com.engine.organization.entity.hrmresource.vo.HrmResourceVO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @Author weaver_cl + * @Description: + * @Date 2022/6/28 + * @Version V1.0 + **/ +public interface ResourceMapper { + + List listAll(@Param("ids")List ids); +} diff --git a/src/com/engine/organization/mapper/resource/ResourceMapper.xml b/src/com/engine/organization/mapper/resource/ResourceMapper.xml new file mode 100644 index 00000000..4435d9dc --- /dev/null +++ b/src/com/engine/organization/mapper/resource/ResourceMapper.xml @@ -0,0 +1,70 @@ + + + + + + + + + id,last_name,department_id,company_id,mobile,telephone,manager_id + + + + + + + AND t.last_name like CONCAT('%',#{param.lastName},'%') + + + + + AND t.last_name like '%'||#{param.lastName}||'%' + + + + + AND t.last_name like '%'+#{param.lastName}+'%' + + + + + + \ No newline at end of file diff --git a/src/com/engine/organization/mapper/scheme/GradeMapper.java b/src/com/engine/organization/mapper/scheme/GradeMapper.java index eb1fa65a..4e246948 100644 --- a/src/com/engine/organization/mapper/scheme/GradeMapper.java +++ b/src/com/engine/organization/mapper/scheme/GradeMapper.java @@ -2,10 +2,12 @@ package com.engine.organization.mapper.scheme; import com.engine.organization.entity.scheme.po.GradePO; +import org.apache.ibatis.annotations.MapKey; import org.apache.ibatis.annotations.Param; import java.util.Collection; import java.util.List; +import java.util.Map; /** * @Author dxfeng @@ -79,4 +81,10 @@ public interface GradeMapper { int getCountByTag(@Param("tag") int tag); List listUsedId(); + + List getGradeNameByIds(@Param("ids") Collection ids); + + @MapKey("id") + List> listGradessByIds(@Param("ids") Collection ids); + } diff --git a/src/com/engine/organization/mapper/scheme/GradeMapper.xml b/src/com/engine/organization/mapper/scheme/GradeMapper.xml index 00ef24cf..7f26ef91 100644 --- a/src/com/engine/organization/mapper/scheme/GradeMapper.xml +++ b/src/com/engine/organization/mapper/scheme/GradeMapper.xml @@ -59,6 +59,24 @@ from JCL_ORG_JOBDT where delete_type = 0 + + update jcl_org_grade diff --git a/src/com/engine/organization/mapper/scheme/LevelMapper.java b/src/com/engine/organization/mapper/scheme/LevelMapper.java index e0bf5d69..eaa33e9b 100644 --- a/src/com/engine/organization/mapper/scheme/LevelMapper.java +++ b/src/com/engine/organization/mapper/scheme/LevelMapper.java @@ -96,4 +96,6 @@ public interface LevelMapper { * @return */ ArrayList getTreeData(); + + List getLevelsByIds(@Param("ids")Collection ids); } diff --git a/src/com/engine/organization/mapper/scheme/LevelMapper.xml b/src/com/engine/organization/mapper/scheme/LevelMapper.xml index 73e115a0..f9b961c7 100644 --- a/src/com/engine/organization/mapper/scheme/LevelMapper.xml +++ b/src/com/engine/organization/mapper/scheme/LevelMapper.xml @@ -80,6 +80,15 @@ from jcl_org_level where delete_type = '0' + update jcl_org_level diff --git a/src/com/engine/organization/mapper/scheme/SchemeMapper.java b/src/com/engine/organization/mapper/scheme/SchemeMapper.java index ea41da19..5c710083 100644 --- a/src/com/engine/organization/mapper/scheme/SchemeMapper.java +++ b/src/com/engine/organization/mapper/scheme/SchemeMapper.java @@ -87,4 +87,6 @@ public interface SchemeMapper { * @return */ ArrayList getTreeData(); + + List getSchemesByIds(@Param("ids")Collection ids); } diff --git a/src/com/engine/organization/mapper/scheme/SchemeMapper.xml b/src/com/engine/organization/mapper/scheme/SchemeMapper.xml index daff34ff..e7c8a485 100644 --- a/src/com/engine/organization/mapper/scheme/SchemeMapper.xml +++ b/src/com/engine/organization/mapper/scheme/SchemeMapper.xml @@ -78,6 +78,16 @@ from jcl_org_scheme where delete_type = '0' + diff --git a/src/com/engine/organization/mapper/sequence/SequenceMapper.java b/src/com/engine/organization/mapper/sequence/SequenceMapper.java index 9d53fd71..3f734ebb 100644 --- a/src/com/engine/organization/mapper/sequence/SequenceMapper.java +++ b/src/com/engine/organization/mapper/sequence/SequenceMapper.java @@ -85,4 +85,5 @@ public interface SequenceMapper { */ int getCountByTag(@Param("tag") int tag); + List getSequencesByIds(@Param("ids") Collection ids); } diff --git a/src/com/engine/organization/mapper/sequence/SequenceMapper.xml b/src/com/engine/organization/mapper/sequence/SequenceMapper.xml index a764662f..4192895f 100644 --- a/src/com/engine/organization/mapper/sequence/SequenceMapper.xml +++ b/src/com/engine/organization/mapper/sequence/SequenceMapper.xml @@ -64,6 +64,16 @@ select sequence_id from JCL_ORG_JOB + update jcl_org_sequence diff --git a/src/com/engine/organization/mapper/SISLog/SISLogMapper.java b/src/com/engine/organization/mapper/sislog/SISLogMapper.java similarity index 82% rename from src/com/engine/organization/mapper/SISLog/SISLogMapper.java rename to src/com/engine/organization/mapper/sislog/SISLogMapper.java index 55a51ca8..7f85970e 100644 --- a/src/com/engine/organization/mapper/SISLog/SISLogMapper.java +++ b/src/com/engine/organization/mapper/sislog/SISLogMapper.java @@ -1,4 +1,4 @@ -package com.engine.organization.mapper.SISLog; +package com.engine.organization.mapper.sislog; import com.engine.organization.entity.LoggerContext; diff --git a/src/com/engine/organization/mapper/SISLog/SISLogMapper.xml b/src/com/engine/organization/mapper/sislog/SISLogMapper.xml similarity index 85% rename from src/com/engine/organization/mapper/SISLog/SISLogMapper.xml rename to src/com/engine/organization/mapper/sislog/SISLogMapper.xml index f9063cde..5c376b9f 100644 --- a/src/com/engine/organization/mapper/SISLog/SISLogMapper.xml +++ b/src/com/engine/organization/mapper/sislog/SISLogMapper.xml @@ -1,6 +1,6 @@ - + @@ -17,7 +17,9 @@ - t.id + t + . + id , t.operate_desc , t.operator_id , t.operator_name @@ -45,7 +47,11 @@ client_ip, method_name, class_name, - delete_type + delete_type, + operate_module_name, + operate_module, + message, + value #{operateDesc}, @@ -57,12 +63,13 @@ #{clientIp}, #{methodName}, #{className}, - #{deleteType} + #{deleteType}, + #{operateModuleName}, + #{operateModule}, + #{message}, + #{value} - - - \ No newline at end of file diff --git a/src/com/engine/organization/mapper/staff/StaffMapper.java b/src/com/engine/organization/mapper/staff/StaffMapper.java index a2ffa394..2293a0b7 100644 --- a/src/com/engine/organization/mapper/staff/StaffMapper.java +++ b/src/com/engine/organization/mapper/staff/StaffMapper.java @@ -63,4 +63,6 @@ public interface StaffMapper { * @return */ List listUsedId(); + + List getStaffsByIds(@Param("ids") Collection ids); } diff --git a/src/com/engine/organization/mapper/staff/StaffMapper.xml b/src/com/engine/organization/mapper/staff/StaffMapper.xml index af99fd66..911a6938 100644 --- a/src/com/engine/organization/mapper/staff/StaffMapper.xml +++ b/src/com/engine/organization/mapper/staff/StaffMapper.xml @@ -63,6 +63,16 @@ and job_id = #{jobId} + update jcl_org_staff diff --git a/src/com/engine/organization/mapper/staff/StaffPlanMapper.java b/src/com/engine/organization/mapper/staff/StaffPlanMapper.java index 2317f4d5..863706c6 100644 --- a/src/com/engine/organization/mapper/staff/StaffPlanMapper.java +++ b/src/com/engine/organization/mapper/staff/StaffPlanMapper.java @@ -72,4 +72,6 @@ public interface StaffPlanMapper { * @return */ List listUsedId(); + + List getStaffPlansByIds(@Param("ids") Collection ids); } diff --git a/src/com/engine/organization/mapper/staff/StaffPlanMapper.xml b/src/com/engine/organization/mapper/staff/StaffPlanMapper.xml index 8b58e308..ea85b493 100644 --- a/src/com/engine/organization/mapper/staff/StaffPlanMapper.xml +++ b/src/com/engine/organization/mapper/staff/StaffPlanMapper.xml @@ -64,6 +64,16 @@ from JCL_ORG_STAFF where delete_type = 0 + update jcl_org_staffplan diff --git a/src/com/engine/organization/service/ExportCommonService.java b/src/com/engine/organization/service/ExportCommonService.java new file mode 100644 index 00000000..f1aac2a2 --- /dev/null +++ b/src/com/engine/organization/service/ExportCommonService.java @@ -0,0 +1,22 @@ +package com.engine.organization.service; + +import com.engine.organization.entity.hrmresource.param.HrmResourceSearchParam; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import java.util.List; + +/** + * @Author weaver_cl + * @Description: + * @Date 2022/6/28 + * @Version V1.0 + **/ +public interface ExportCommonService { + + /** + * 人员导出 + * @param ids + * @return + */ + XSSFWorkbook resourceExport(List ids); +} diff --git a/src/com/engine/organization/service/ExtService.java b/src/com/engine/organization/service/ExtService.java index 172414da..2b848726 100644 --- a/src/com/engine/organization/service/ExtService.java +++ b/src/com/engine/organization/service/ExtService.java @@ -38,7 +38,7 @@ public interface ExtService { * @param groupId * @return */ - List getExtSaveForm(User user, String extendType, String tableName, int viewAttr, String groupId, String autoNoField, String serialType); + List getExtSaveForm(User user, String extendType, String tableName, int viewAttr, String groupId, String autoNoField, String serialType, String... readOnlyFields); /** * 组装明细表表单 diff --git a/src/com/engine/organization/service/HrmResourceService.java b/src/com/engine/organization/service/HrmResourceService.java index 5c0193b3..f7a3ddc8 100644 --- a/src/com/engine/organization/service/HrmResourceService.java +++ b/src/com/engine/organization/service/HrmResourceService.java @@ -1,5 +1,6 @@ package com.engine.organization.service; +import com.engine.organization.entity.hrmresource.param.HrmRelationSaveParam; import com.engine.organization.entity.hrmresource.param.HrmResourceSearchParam; import com.engine.organization.entity.searchtree.SearchTreeParams; @@ -73,4 +74,25 @@ public interface HrmResourceService { * @return */ Map getHasRight(); + + /** + * 拓展表单 + */ + Map getTabForm(Map params); + + /** + * 新增拓展表单 + * + * @param params + * @return + */ + long saveTabForm(HrmRelationSaveParam params); + + /** + * 更新拓展表单 + * + * @param params + * @return + */ + long updateTabForm(HrmRelationSaveParam params); } diff --git a/src/com/engine/organization/service/ImportCommonService.java b/src/com/engine/organization/service/ImportCommonService.java new file mode 100644 index 00000000..feaa1c58 --- /dev/null +++ b/src/com/engine/organization/service/ImportCommonService.java @@ -0,0 +1,33 @@ +package com.engine.organization.service; + +import weaver.hrm.User; + +import javax.servlet.http.HttpServletRequest; +import java.util.Map; + +/** + * @author:dxfeng + * @createTime: 2022/06/29 + * @version: 1.0 + */ +public interface ImportCommonService { + /** + * 人员导入 + * + * @param params + * @param request + * @return + */ + Map saveImportResource(Map params, HttpServletRequest request); + + + /** + * 通用导入 + * + * @param params + * @param request + * @param user + * @return + */ + Map saveImport(Map params, HttpServletRequest request, User user); +} diff --git a/src/com/engine/organization/service/LogViewService.java b/src/com/engine/organization/service/LogViewService.java new file mode 100644 index 00000000..3a8ac1c4 --- /dev/null +++ b/src/com/engine/organization/service/LogViewService.java @@ -0,0 +1,24 @@ +package com.engine.organization.service; + +import com.engine.organization.entity.logview.param.LogViewSearchParam; + +import java.util.Map; + +/** + * @author:dxfeng + * @createTime: 2022/07/05 + * @version: 1.0 + */ +public interface LogViewService { + /** + * 日志列表 + * + * @param param + * @return + */ + Map listPage(LogViewSearchParam param); + + Map getSearchCondition(); + + String showDetailById(Long id); +} diff --git a/src/com/engine/organization/service/OrgChartService.java b/src/com/engine/organization/service/OrgChartService.java new file mode 100644 index 00000000..917c77a3 --- /dev/null +++ b/src/com/engine/organization/service/OrgChartService.java @@ -0,0 +1,19 @@ +package com.engine.organization.service; + +import weaver.hrm.User; + +import java.util.Map; + +/** + * @className: OrgChartService + * @author: dengjp + * @date: 2022/7/7 + * @description: 组织架构图Service + **/ +public interface OrgChartService { + Map getOptionCondition(Map request2Map, User user); + + Map getCompanyData(Map request2Map, User user); + + Map getUserData(Map request2Map, User user); +} diff --git a/src/com/engine/organization/service/SchemeService.java b/src/com/engine/organization/service/SchemeService.java index 7d5aa550..f1d6e387 100644 --- a/src/com/engine/organization/service/SchemeService.java +++ b/src/com/engine/organization/service/SchemeService.java @@ -29,7 +29,7 @@ public interface SchemeService { * @param param * @return */ - Map save(SchemeSearchParam param); + int save(SchemeSearchParam param); /** * 更新等级方案信息 @@ -37,21 +37,23 @@ public interface SchemeService { * @param param * @return */ - Map updateScheme(SchemeSearchParam param); + int updateScheme(SchemeSearchParam param); /** * 更新禁用标记 * * @param params + * @return */ - void updateForbiddenTagById(SchemeSearchParam params); + int updateForbiddenTagById(SchemeSearchParam params); /** * 根据ID批量删除等级方案信息 * * @param ids + * @return */ - void deleteByIds(Collection ids); + int deleteByIds(Collection ids); /** * 获取搜索条件 diff --git a/src/com/engine/organization/service/impl/CompServiceImpl.java b/src/com/engine/organization/service/impl/CompServiceImpl.java index 91c746b9..32c400e3 100644 --- a/src/com/engine/organization/service/impl/CompServiceImpl.java +++ b/src/com/engine/organization/service/impl/CompServiceImpl.java @@ -141,7 +141,7 @@ public class CompServiceImpl extends Service implements CompService { // 判断是否开启自动编号 compNo = repeatDetermine(compNo); params.put("comp_no", compNo); - if (StringUtils.isBlank(params.get("show_order").toString())) { + if (null == params.get("show_order") || StringUtils.isBlank(params.get("show_order").toString())) { int maxShowOrder = getCompMapper().getMaxShowOrder(); params.put("show_order", maxShowOrder + 1); } diff --git a/src/com/engine/organization/service/impl/DemoServiceImpl.java b/src/com/engine/organization/service/impl/DemoServiceImpl.java index d5adcd73..f1505965 100644 --- a/src/com/engine/organization/service/impl/DemoServiceImpl.java +++ b/src/com/engine/organization/service/impl/DemoServiceImpl.java @@ -1,19 +1,13 @@ package com.engine.organization.service.impl; import com.engine.core.impl.Service; -import com.engine.organization.annotation.Log; -import com.engine.organization.entity.LoggerContext; import com.engine.organization.entity.po.Demo; -import com.engine.organization.enums.OperateTypeEnum; import com.engine.organization.mapper.DemoMapper; import com.engine.organization.service.DemoService; import com.engine.organization.util.HrmI18nUtil; -import com.engine.organization.util.LogAspect; import com.engine.organization.util.OrganizationAssert; import com.engine.organization.util.db.MapperProxyFactory; -import com.weaverboot.frame.ioc.anno.classAnno.WeaIocService; -import java.lang.reflect.Method; import java.util.List; /** @@ -22,24 +16,42 @@ import java.util.List; * @Date 2022/4/27 * @Version V1.0 **/ -@WeaIocService +//@WeaIocService +//@WeaIocReplaceComponent("demoService") //如不标注名称,则按类的全路径注入 public class DemoServiceImpl extends Service implements DemoService { @Override - @Log(operateType = OperateTypeEnum.ADD,operateDesc = "测试自定义日志") + //@Log(operateType = OperateTypeEnum.ADD,operateDesc = "测试自定义日志") public List list(String name) { - OrganizationAssert.notNull(name,HrmI18nUtil.getI18nLabel(34721,"参数不能为空") ); + OrganizationAssert.notNull(name, HrmI18nUtil.getI18nLabel(34721, "参数不能为空")); List demos = MapperProxyFactory.getProxy(DemoMapper.class).listAll(); - //操作日志记录 - Method method = new Object(){}.getClass().getEnclosingMethod(); - LoggerContext loggerContext = LoggerContext.builder().operatorId(user.getUID()).operatorName(user.getLastname()).build(); - LogAspect logAspect = new LogAspect(DemoServiceImpl.class,method,loggerContext); - logAspect.start(); + ////操作日志记录 + //Method method = new Object() { + //}.getClass().getEnclosingMethod(); + //LoggerContext loggerContext = LoggerContext.builder().operatorId(user.getUID()).operatorName(user.getLastname()).build(); + //LogAspect logAspect = new LogAspect(DemoServiceImpl.class, method, loggerContext); + //logAspect.start(); return demos; } + + + + + + //这个是接口后置方法,大概的用法跟前置方法差不多,稍有差别 + //注解名称为WeaReplaceAfter + //返回类型必须为String + //参数叫WeaAfterReplaceParam,这个类前四个参数跟前置方法的那个相同,不同的是多了一个叫data的String,这个是那个接口执行完返回的报文 + //@WeaReplaceAfter(value = "/api/bs/hrmorganization/scheme/updateForbiddenTagById",order = 1) +// public void after(WeaAfterReplaceParam weaAfterReplaceParam){ +// +// String data = weaAfterReplaceParam.getData();//这个就是接口执行完的报文 +// System.out.println(data); +// //日志记录 +// } } diff --git a/src/com/engine/organization/service/impl/DepartmentServiceImpl.java b/src/com/engine/organization/service/impl/DepartmentServiceImpl.java index 741da437..ea131aca 100644 --- a/src/com/engine/organization/service/impl/DepartmentServiceImpl.java +++ b/src/com/engine/organization/service/impl/DepartmentServiceImpl.java @@ -388,12 +388,16 @@ public class DepartmentServiceImpl extends Service implements DepartmentService // 处理自动编号 deptById.setDeptNo(CodeRuleUtil.generateCode(RuleCodeType.DEPARTMENT, deptById.getDeptNo(), false)); deptById.setParentComp(Long.parseLong(copyParam.getCompany())); + deptById.setParentDept(null); // 显示顺序字段 deptById.setShowOrder(maxShowOrder + i + 1); insertCount += getDepartmentMapper().insertIgnoreNull(deptById); if ("1".equals(copyParam.getCopyJob())) { List jobPOS = MapperProxyFactory.getProxy(JobMapper.class).listJobsByDepartmentId(idList.get(i)); - int maxJobOrder = MapperProxyFactory.getProxy(JobMapper.class).getMaxShowOrder(); + Integer maxJobOrder = MapperProxyFactory.getProxy(JobMapper.class).getMaxShowOrder(); + if (maxJobOrder == null) { + maxJobOrder = 0; + } recursionCopyJob((long) user.getUID(), jobPOS, deptById.getParentComp(), deptById.getId(), maxJobOrder); } } diff --git a/src/com/engine/organization/service/impl/ExportCommonServiceImpl.java b/src/com/engine/organization/service/impl/ExportCommonServiceImpl.java new file mode 100644 index 00000000..35bfb467 --- /dev/null +++ b/src/com/engine/organization/service/impl/ExportCommonServiceImpl.java @@ -0,0 +1,61 @@ +package com.engine.organization.service.impl; + +import com.engine.core.impl.Service; +import com.engine.organization.entity.hrmresource.param.HrmResourceSearchParam; +import com.engine.organization.entity.hrmresource.vo.HrmResourceVO; +import com.engine.organization.mapper.resource.ResourceMapper; +import com.engine.organization.service.ExportCommonService; +import com.engine.organization.util.HrmI18nUtil; +import com.engine.organization.util.db.MapperProxyFactory; +import com.engine.organization.util.excel.ExcelUtil; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import java.util.*; + +/** + * @Author weaver_cl + * @Description: + * @Date 2022/6/28 + * @Version V1.0 + **/ +public class ExportCommonServiceImpl extends Service implements ExportCommonService { + + @Override + public XSSFWorkbook resourceExport(List ids) { + + List hrmResourceVOS = MapperProxyFactory.getProxy(ResourceMapper.class).listAll(ids); + if (hrmResourceVOS == null) { + hrmResourceVOS = new ArrayList<>(); + } + // 1.工作簿名称 + String sheetName = HrmI18nUtil.getI18nLabel(85368, "人员档案数据"); + // 2.表头(后面动态获取) + List> excelSheetData = new ArrayList<>(); + + String[] header = { + HrmI18nUtil.getI18nLabel( 93270, "姓名"), + HrmI18nUtil.getI18nLabel( 93272, "部门"), + HrmI18nUtil.getI18nLabel( 93274, "分部"), + HrmI18nUtil.getI18nLabel( 93275, "移动电话"), + HrmI18nUtil.getI18nLabel( 93278, "办公室电话"), + HrmI18nUtil.getI18nLabel( 93279, "直接上级")}; + excelSheetData.add(Arrays.asList(header)); + + //数据 + List> rows = new LinkedList<>(); + for (HrmResourceVO vo : hrmResourceVOS) { + List row = new LinkedList<>(); + row.add(vo.getLastName()); + row.add(vo.getDepartmentName()); + row.add(vo.getCompanyName()); + row.add(vo.getMobile()); + row.add(vo.getTelephone()); + row.add(vo.getManagerName()); + rows.add(row); + } + excelSheetData.addAll(rows); + return ExcelUtil.genWorkbookV2(excelSheetData, sheetName); + } + + +} diff --git a/src/com/engine/organization/service/impl/ExtServiceImpl.java b/src/com/engine/organization/service/impl/ExtServiceImpl.java index 5efdfc0f..1a4e6491 100644 --- a/src/com/engine/organization/service/impl/ExtServiceImpl.java +++ b/src/com/engine/organization/service/impl/ExtServiceImpl.java @@ -74,7 +74,7 @@ public class ExtServiceImpl extends Service implements ExtService { SearchConditionItem item = ExtendInfoBO.getSearchConditionItem(user, viewAttr, extendInfoPO, null == compExtMap ? null : compExtMap.get(extendInfoPO.getFieldName())); item.setFieldcol(16); if (2 == viewAttr) { - if (readOnlyFieldList.contains(extendInfoPO.getFieldName())) { + if (CollectionUtils.isNotEmpty(readOnlyFieldList) && readOnlyFieldList.contains(extendInfoPO.getFieldName())) { item.setViewAttr(1); } else if (1 == extendInfoPO.getIsrequired()) { item.setViewAttr(3); @@ -91,17 +91,20 @@ public class ExtServiceImpl extends Service implements ExtService { } @Override - public List getExtSaveForm(User user, String extendType, String tableName, int viewAttr, String groupId, String autoNoField, String serialType) { + public List getExtSaveForm(User user, String extendType, String tableName, int viewAttr, String groupId, String autoNoField, String serialType, String... readOnlyFields) { List conditionItems = new ArrayList<>(); // 2编辑 1查看 OrganizationAssert.notNull(groupId, "请选择对应的拓展页"); List infoPOList = getExtendInfoMapper().listFields(extendType, groupId, tableName, ExtendInfoOperateType.ADD.getValue()); // 组装拓展页内容 + List readOnlyFieldList = Arrays.asList(readOnlyFields); for (ExtendInfoPO extendInfoPO : infoPOList) { SearchConditionItem item = ExtendInfoBO.getSearchConditionItem(user, viewAttr, extendInfoPO, null); item.setFieldcol(16); - if (1 == extendInfoPO.getIsrequired()) { + if (CollectionUtils.isNotEmpty(readOnlyFieldList) && readOnlyFieldList.contains(extendInfoPO.getFieldName())) { + item.setViewAttr(1); + } else if (1 == extendInfoPO.getIsrequired()) { item.setViewAttr(3); item.setRules("required"); } diff --git a/src/com/engine/organization/service/impl/GradeServiceImpl.java b/src/com/engine/organization/service/impl/GradeServiceImpl.java index d2017f94..8b1e6bbc 100644 --- a/src/com/engine/organization/service/impl/GradeServiceImpl.java +++ b/src/com/engine/organization/service/impl/GradeServiceImpl.java @@ -157,8 +157,24 @@ public class GradeServiceImpl extends Service implements GradeService { BrowserBean levelBrowserBean = levelBrowserItem.getBrowserConditionParam(); List> levelMaps = getLevelMapper().listLevelsByIds(DeleteParam.builder().ids(gradePO.getLevelId()).build().getIds()); levelBrowserBean.setReplaceDatas(levelMaps); + long l = System.currentTimeMillis(); + Map completeParams = levelBrowserBean.getCompleteParams(); + completeParams.put("currenttime", l); + completeParams.put("scheme_id_"+ l,gradePO.getSchemeId()); + Map conditionDataParams = levelBrowserBean.getConditionDataParams(); + conditionDataParams.put("currenttime", l); + conditionDataParams.put("scheme_id_"+ l,gradePO.getSchemeId()); + Map dataParams = levelBrowserBean.getDataParams(); + dataParams.put("currenttime", l); + dataParams.put("scheme_id_"+ l,gradePO.getSchemeId()); + Map destDataParams = levelBrowserBean.getDestDataParams(); + destDataParams.put("currenttime", l); + destDataParams.put("scheme_id_"+ l,gradePO.getSchemeId()); + levelBrowserItem.setBrowserConditionParam(levelBrowserBean); + levelBrowserItem.setRelatekey("schemeId"); + // 编辑状态下,编号只读 // gradeNoCondition.setViewAttr(1); } diff --git a/src/com/engine/organization/service/impl/HrmResourceServiceImpl.java b/src/com/engine/organization/service/impl/HrmResourceServiceImpl.java index 8dc22340..026ec1ac 100644 --- a/src/com/engine/organization/service/impl/HrmResourceServiceImpl.java +++ b/src/com/engine/organization/service/impl/HrmResourceServiceImpl.java @@ -1,5 +1,6 @@ package com.engine.organization.service.impl; +import com.api.browser.bean.BrowserBean; import com.api.browser.bean.SearchConditionGroup; import com.api.browser.bean.SearchConditionItem; import com.cloudstore.eccom.result.WeaResultMsg; @@ -12,8 +13,11 @@ import com.engine.organization.entity.company.po.CompPO; import com.engine.organization.entity.department.bo.DepartmentBO; import com.engine.organization.entity.department.po.DepartmentPO; import com.engine.organization.entity.extend.po.ExtendTitlePO; +import com.engine.organization.entity.hrmresource.bo.HrmRelationBO; +import com.engine.organization.entity.hrmresource.param.HrmRelationSaveParam; import com.engine.organization.entity.hrmresource.param.HrmResourceSearchParam; -import com.engine.organization.entity.hrmresource.vo.HrmResourceVO; +import com.engine.organization.entity.hrmresource.po.HrmRelationPO; +import com.engine.organization.entity.hrmresource.vo.ScHrmResourceVO; import com.engine.organization.entity.job.bo.JobBO; import com.engine.organization.entity.job.po.JobPO; import com.engine.organization.entity.searchtree.SearchTree; @@ -21,7 +25,14 @@ import com.engine.organization.entity.searchtree.SearchTreeParams; import com.engine.organization.mapper.comp.CompMapper; import com.engine.organization.mapper.department.DepartmentMapper; import com.engine.organization.mapper.extend.ExtendTitleMapper; +import com.engine.organization.mapper.hrmresource.HrmRelationMapper; import com.engine.organization.mapper.job.JobMapper; +import com.engine.organization.mapper.post.PostInfoMapper; +import com.engine.organization.mapper.post.PostMapper; +import com.engine.organization.mapper.scheme.GradeMapper; +import com.engine.organization.mapper.scheme.LevelMapper; +import com.engine.organization.mapper.scheme.SchemeMapper; +import com.engine.organization.mapper.sequence.SequenceMapper; import com.engine.organization.service.ExtService; import com.engine.organization.service.HrmResourceService; import com.engine.organization.util.MenuBtn; @@ -39,6 +50,7 @@ import weaver.hrm.User; import java.util.*; import java.util.stream.Collectors; +import java.util.stream.Stream; /** * @author:dxfeng @@ -82,6 +94,34 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic */ private static final String JCL_ORG_HRMEXT_DT1 = "JCL_ORG_HRMRESOURCEEXT_DT1"; + private SchemeMapper getSchemeMapper() { + return MapperProxyFactory.getProxy(SchemeMapper.class); + } + + private LevelMapper getLevelMapper() { + return MapperProxyFactory.getProxy(LevelMapper.class); + } + + private GradeMapper getGradeMapper() { + return MapperProxyFactory.getProxy(GradeMapper.class); + } + + private SequenceMapper getSequenceMapper() { + return MapperProxyFactory.getProxy(SequenceMapper.class); + } + + private PostMapper getPostMapper() { + return MapperProxyFactory.getProxy(PostMapper.class); + } + + private PostInfoMapper getPostInfoMapper() { + return MapperProxyFactory.getProxy(PostInfoMapper.class); + } + + private HrmRelationMapper getHrmRelationMapper() { + return MapperProxyFactory.getProxy(HrmRelationMapper.class); + } + private DepartmentMapper getDepartmentMapper() { return MapperProxyFactory.getProxy(DepartmentMapper.class); } @@ -102,6 +142,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic return ServiceUtil.getService(ExtServiceImpl.class, user); } + @Override public Map getSearchTree(SearchTreeParams params) { String keyword = params.getKeyword(); @@ -114,7 +155,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic @Override public Map listPage(HrmResourceSearchParam params) { Map resultMap = new HashMap<>(); - OrganizationWeaTable table = new OrganizationWeaTable<>(user, HrmResourceVO.class); + OrganizationWeaTable table = new OrganizationWeaTable<>(user, ScHrmResourceVO.class); String sqlWhere = buildSqlWhere(params); table.setSqlwhere(sqlWhere); WeaResultMsg result = new WeaResultMsg(false); @@ -206,7 +247,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic List addGroups = new ArrayList<>(); List conditionItems = new ArrayList<>(); SearchConditionItem lastNameItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "姓名", "lastName"); - SearchConditionItem managerIdItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "直接上级", "managerId"); + SearchConditionItem managerIdItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "直接上级", "1", "managerId", ""); SearchConditionItem companyIdItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "分部", "161", "companyId", "compBrowser"); SearchConditionItem departmentIdItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "部门", "161", "departmentId", "deptBrowser"); SearchConditionItem telephoneItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "办公电话", "telephone"); @@ -234,14 +275,125 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic ArrayList topMenuList = new ArrayList<>(); ArrayList rightMenuList = new ArrayList<>(); topMenuList.add(MenuBtn.builder().isBatch("1").isTop("1").menuFun("new").menuIcon("icon-coms-New-Flow").menuName("新建人员").type("BTN_Addnew").build()); - topMenuList.add(MenuBtn.builder().isBatch("1").isTop("1").menuFun("import").menuIcon("icon-coms-leading-in").menuName("导入人员").type("BTN_Import").build()); + //topMenuList.add(MenuBtn.builder().isBatch("1").isTop("1").menuFun("import").menuIcon("icon-coms-leading-in").menuName("导入人员").type("BTN_Import").build()); btnDatas.put("topMenu", topMenuList); rightMenuList.add(MenuBtn.builder().isBatch("1").isTop("1").menuFun("new").menuIcon("icon-coms-New-Flow").menuName("新建人员").type("BTN_Addnew").build()); - rightMenuList.add(MenuBtn.builder().isBatch("1").isTop("1").menuFun("import").menuIcon("icon-coms-leading-in").menuName("导入人员").type("BTN_Import").build()); + //rightMenuList.add(MenuBtn.builder().isBatch("1").isTop("1").menuFun("import").menuIcon("icon-coms-leading-in").menuName("导入人员").type("BTN_Import").build()); + rightMenuList.add(MenuBtn.builder().isBatch("0").isTop("0").menuFun("custom").menuIcon("icon-coms-task-list").menuName("显示列定制").type("BTN_COLUMN").build()); btnDatas.put("rightMenu", rightMenuList); return btnDatas; } + @Override + public Map getTabForm(Map params) { + String viewAttrStr = (String) params.get("viewAttr"); + OrganizationAssert.notBlank(viewAttrStr, "未指定操作类型,请确认"); + String id = Util.null2String(params.get("id")); + OrganizationAssert.notBlank(id, "数据有误,请确认"); + int viewAttr = Integer.parseInt(viewAttrStr); + Map apiDatas = new HashMap<>(); + List selectItems = new ArrayList<>(); + List addGroups = new ArrayList<>(); + SearchConditionItem schemeId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "等级方案", "161", "schemeId", "schemeBrowser"); + schemeId.setRules("required"); + SearchConditionItem gradeId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "职级", "161", "gradeId", "gradeBrowser"); + gradeId.setRules("required"); + SearchConditionItem levelId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "职等", "162", "levelId", "levelBrowser"); + levelId.setRules("required"); + SearchConditionItem sequenceId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "岗位序列", "161", "sequenceId", "sequenceBrowser"); + sequenceId.setRules("required"); + SearchConditionItem postId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "职务分类", "161", "postId", "postBrowser"); + postId.setRules("required"); + SearchConditionItem postInfoId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "职务信息", "161", "postInfoId", "postInfoBrowser"); + postInfoId.setRules("required"); + SearchConditionItem companyId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "分部", "161", "companyId", "compBrowser"); + companyId.setRules("required"); + SearchConditionItem departmentId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "部门", "161", "departmentId", "deptBrowser"); + departmentId.setRules("required"); + SearchConditionItem jobId = OrganizationFormItemUtil.browserItem(user, 2, 17, viewAttr, false, "岗位", "161", "jobId", "jobBrowser"); + jobId.setRules("required"); + + + // 编辑状态下赋值操作 + HrmRelationPO relationPO = getHrmRelationMapper().getRelationById(Long.parseLong(id)); + if (null != relationPO) { + setBrowserValue(schemeId, relationPO.getSchemeId(), getSchemeMapper().listSchemesByIds(Stream.of(relationPO.getSchemeId()).collect(Collectors.toList())), null, null); + setBrowserValue(gradeId, relationPO.getGradeId(), getGradeMapper().listGradessByIds(Stream.of(relationPO.getGradeId()).collect(Collectors.toList())), "scheme_id", relationPO.getSchemeId()); + setBrowserValue(levelId, relationPO.getLevelId(), getLevelMapper().listLevelsByIds(DeleteParam.builder().ids(relationPO.getLevelId()).build().getIds()), "grade_id", relationPO.getGradeId()); + setBrowserValue(sequenceId, relationPO.getSequenceId(), getSequenceMapper().listSequencesByIds(Stream.of(relationPO.getSequenceId()).collect(Collectors.toList())), "scheme_id", relationPO.getSchemeId()); + setBrowserValue(postId, relationPO.getPostId(), getPostMapper().listPostsByIds(Stream.of(relationPO.getPostId()).collect(Collectors.toList())), null, null); + setBrowserValue(postInfoId, relationPO.getPostInfoId(), getPostInfoMapper().listPostInfosByIds(Stream.of(relationPO.getPostInfoId()).collect(Collectors.toList())), "post_id", relationPO.getPostId()); + setBrowserValue(companyId, relationPO.getCompanyId(), getCompMapper().listCompsByIds(Stream.of(relationPO.getCompanyId()).collect(Collectors.toList())), null, null); + setBrowserValue(departmentId, relationPO.getDepartmentId(), getDepartmentMapper().listDeptsByIds(Stream.of(relationPO.getDepartmentId()).collect(Collectors.toList())), "comp_id", relationPO.getCompanyId()); + setBrowserValue(jobId, relationPO.getJobId(), getJobMapper().listJobsByIds(Stream.of(relationPO.getJobId()).collect(Collectors.toList())), "dept_id", relationPO.getDepartmentId()); + } + + selectItems.add(schemeId); + selectItems.add(gradeId); + selectItems.add(levelId); + selectItems.add(sequenceId); + selectItems.add(postId); + selectItems.add(postInfoId); + selectItems.add(companyId); + selectItems.add(departmentId); + selectItems.add(jobId); + addGroups.add(new SearchConditionGroup("基本信息", true, selectItems)); + HashMap buttonsMap = new HashMap<>(); + buttonsMap.put("hasEdit", true); + buttonsMap.put("hasSave", true); + apiDatas.put("buttons", buttonsMap); + apiDatas.put("conditions", addGroups); + return apiDatas; + } + + @Override + public long saveTabForm(HrmRelationSaveParam params) { + HrmRelationPO hrmRelationPO = HrmRelationBO.convertSaveParamToPO(params); + hrmRelationPO.setCreator((long) user.getUID()); + hrmRelationPO.setCreateTime(new Date()); + hrmRelationPO.setDeleteType(0); + getHrmRelationMapper().insertIgnoreNull(hrmRelationPO); + return hrmRelationPO.getId(); + } + + @Override + public long updateTabForm(HrmRelationSaveParam params) { + HrmRelationPO hrmRelationPO = HrmRelationBO.convertSaveParamToPO(params); + hrmRelationPO.setUpdateTime(new Date()); + getHrmRelationMapper().updateHrmRelation(hrmRelationPO); + return hrmRelationPO.getId(); + } + + /** + * 浏览按钮赋值 + * + * @param browserItem + * @param browserValue + * @param maps + */ + private void setBrowserValue(SearchConditionItem browserItem, Object browserValue, List> maps, String relateField, Object relatedValue) { + browserItem.setValue(browserValue); + BrowserBean browserBean = browserItem.getBrowserConditionParam(); + browserBean.setReplaceDatas(maps); + browserItem.setBrowserConditionParam(browserBean); + + if (StringUtils.isNotBlank(relateField) && 1 != browserItem.getViewAttr()) { + long l = System.currentTimeMillis(); + Map completeParams = browserBean.getCompleteParams(); + completeParams.put("currenttime", l); + completeParams.put(relateField + "_" + l, relatedValue); + Map conditionDataParams = browserBean.getConditionDataParams(); + conditionDataParams.put("currenttime", l); + conditionDataParams.put(relateField + "_" + l, relatedValue); + Map dataParams = browserBean.getDataParams(); + dataParams.put("currenttime", l); + dataParams.put(relateField + "_" + l, relatedValue); + Map destDataParams = browserBean.getDestDataParams(); + destDataParams.put("currenttime", l); + destDataParams.put(relateField + "_" + l, relatedValue); + } + } + /** * 查询条件 * @@ -250,22 +402,22 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic */ private String buildSqlWhere(HrmResourceSearchParam params) { DBType dbType = DBType.get(new RecordSet().getDBType()); - String sqlWhere = " where t.delete_type ='0' "; + String sqlWhere = " where 1=1 "; String lastName = params.getLastName(); if (StringUtils.isNotBlank(lastName)) { - sqlWhere += " AND t.last_name " + dbType.like(lastName); + sqlWhere += " AND t.lastname " + dbType.like(lastName); } Long managerId = params.getManagerId(); if (null != managerId) { - sqlWhere += " AND t.manager_id = '" + managerId + "'"; + sqlWhere += " AND t.managerid = '" + managerId + "'"; } Long companyId = params.getCompanyId(); if (null != companyId) { - sqlWhere += " AND t.company_id = '" + companyId + "'"; + sqlWhere += " AND t.subcompanyid1 = '" + companyId + "'"; } Long departmentId = params.getDepartmentId(); if (null != departmentId) { - sqlWhere += " AND t.department_id = '" + departmentId + "'"; + sqlWhere += " AND t.departmentid = '" + departmentId + "'"; } String telephone = params.getTelephone(); if (StringUtils.isNotBlank(telephone)) { @@ -277,11 +429,11 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic } String mobileCall = params.getMobileCall(); if (StringUtils.isNotBlank(mobileCall)) { - sqlWhere += " AND t.mobile_call " + dbType.like(mobileCall); + sqlWhere += " AND t.mobilecall " + dbType.like(mobileCall); } Long jobTitle = params.getJobTitle(); if (null != jobTitle) { - sqlWhere += " AND t.job_title = '" + jobTitle + "'"; + sqlWhere += " AND t.jobtitle = '" + jobTitle + "'"; } return sqlWhere; diff --git a/src/com/engine/organization/service/impl/ImportCommonServiceImpl.java b/src/com/engine/organization/service/impl/ImportCommonServiceImpl.java new file mode 100644 index 00000000..10bf92fe --- /dev/null +++ b/src/com/engine/organization/service/impl/ImportCommonServiceImpl.java @@ -0,0 +1,105 @@ +package com.engine.organization.service.impl; + +import com.engine.core.impl.Service; +import com.engine.organization.entity.hrmresource.param.HrmResourceImportParam; +import com.engine.organization.service.ImportCommonService; +import com.engine.organization.util.saveimport.HrmResourceImportAdaptUtil; +import com.engine.organization.util.saveimport.HrmResourceImportProcessUtil; +import com.engine.organization.util.saveimport.SaveImportProcessUtil; +import weaver.file.FileUploadToPath; +import weaver.general.BaseBean; +import weaver.general.Util; +import weaver.hrm.User; +import weaver.systeminfo.SystemEnv; + +import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @author:dxfeng + * @createTime: 2022/06/29 + * @version: 1.0 + */ +public class ImportCommonServiceImpl extends Service implements ImportCommonService { + + @Override + public Map saveImportResource(Map params, HttpServletRequest request) { + + Map returnMap = new HashMap<>(); + try { + String keyField = (String) params.get("keyField"); + switch (keyField) { + case "workcode": + params.put("keyField","work_code"); + break; + case "lastname": + params.put("keyField","last_name"); + break; + case "loginid": + params.put("keyField","login_id"); + break; + default: + break; + + } + /*综合考虑多数据源后,实现通过配置文件配置适配器和解析类*/ + List lsErrorInfo = new ArrayList<>(); + HrmResourceImportAdaptUtil importAdaptUtil = new HrmResourceImportAdaptUtil(); + FileUploadToPath fu = new FileUploadToPath(request); + int language = this.user.getLanguage(); + importAdaptUtil.setUserlanguage(language); + List errorInfo = importAdaptUtil.creatImportMap(fu); + //如果读取数据和验证模板没有发生错误 + if (errorInfo.isEmpty()) { + Map hrMap = importAdaptUtil.getHrmImportMap(); + HrmResourceImportProcessUtil importProcessUtil = new HrmResourceImportProcessUtil(); + importProcessUtil.init(request); + importProcessUtil.processMap(hrMap); + } else { + Map error; + for (String s : errorInfo) { + error = new HashMap<>(); + error.put("message", Util.null2String(s)); + lsErrorInfo.add(error); + } + } + returnMap.put("errorInfo", lsErrorInfo); + returnMap.put("status", "1"); + } catch (Exception e) { + returnMap.put("status", "-1"); + returnMap.put("message", e.getMessage()); + } + return returnMap; + } + + @Override + public Map saveImport(Map params, HttpServletRequest request, User user) { + Map returnMap = new HashMap<>(); + request.getSession(true).setAttribute("importBaseCreater", user); + try { + List lsErrorInfo = new ArrayList<>(); + SaveImportProcessUtil importProcessUtil = new SaveImportProcessUtil(); + List errorInfo = importProcessUtil.importXls(request); + if (errorInfo != null && !errorInfo.isEmpty()) { + Map error; + for (String s : errorInfo) { + error = new HashMap<>(); + error.put("message", Util.null2String(s)); + lsErrorInfo.add(error); + } + } + returnMap.put("errorInfo", lsErrorInfo); + returnMap.put("status", "1"); + returnMap.put("message", SystemEnv.getHtmlLabelName(24645, user.getLanguage())); + } catch (Exception e) { + new BaseBean().writeLog("导入基础数据失败:" + e); + returnMap.put("status", "-1"); + returnMap.put("message", e.getMessage()); + } + returnMap.put("pid", request.getSession(true).getAttribute("importExcelPid")); + return returnMap; + } +} diff --git a/src/com/engine/organization/service/impl/JobServiceImpl.java b/src/com/engine/organization/service/impl/JobServiceImpl.java index 88370b33..1cf4ee1f 100644 --- a/src/com/engine/organization/service/impl/JobServiceImpl.java +++ b/src/com/engine/organization/service/impl/JobServiceImpl.java @@ -17,8 +17,6 @@ import com.engine.organization.entity.company.po.CompPO; import com.engine.organization.entity.department.bo.DepartmentBO; import com.engine.organization.entity.department.po.DepartmentPO; import com.engine.organization.entity.employee.vo.EmployeeTableVO; -import com.engine.organization.entity.extend.bo.ExtendInfoBO; -import com.engine.organization.entity.extend.po.ExtendInfoPO; import com.engine.organization.entity.extend.po.ExtendTitlePO; import com.engine.organization.entity.job.bo.JobBO; import com.engine.organization.entity.job.dto.JobListDTO; @@ -215,12 +213,6 @@ public class JobServiceImpl extends Service implements JobService { SearchConditionItem isKeyItem = OrganizationFormItemUtil.selectItem(user, isKeyOptions, 2, 16, 6, false, "是否关键岗", "forbiddenTag"); // 工作地点 SearchConditionItem workplaceItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "工作地点", "workplace"); - // 工作概述 - // SearchConditionItem descriptionItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "工作概述", "description"); - // 任职职责 - //SearchConditionItem workDutyItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "任职职责", "workDuty"); - // 工作权限 - // SearchConditionItem workAuthorityItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "工作权限", "workAuthority"); // 禁用标记 List selectOptions = new ArrayList<>(); SearchConditionOption enableOption = new SearchConditionOption("true", "启用"); @@ -238,9 +230,6 @@ public class JobServiceImpl extends Service implements JobService { conditionItems.add(parentJobBrowserItem); conditionItems.add(isKeyItem); conditionItems.add(workplaceItem); - //conditionItems.add(descriptionItem); - //conditionItems.add(workDutyItem); - //conditionItems.add(workAuthorityItem); conditionItems.add(forbiddenTagItem); addGroups.add(new SearchConditionGroup("高级搜索条件", true, conditionItems)); @@ -256,7 +245,7 @@ public class JobServiceImpl extends Service implements JobService { List extendTitles = getExtendTitleMapper().getTitlesByGroupID(GROUP_ID); if (CollectionUtils.isNotEmpty(extendTitles)) { for (ExtendTitlePO extendTitle : extendTitles) { - List items = getExtService(user).getExtSaveForm(user, EXTEND_TYPE + "", JCL_ORG_JOB, 2, extendTitle.getId().toString(), "job_no", RuleCodeType.JOBTITLES.getValue()); + List items = getExtService(user).getExtSaveForm(user, EXTEND_TYPE + "", JCL_ORG_JOB, 2, extendTitle.getId().toString(), "job_no", RuleCodeType.JOBTITLES.getValue(), "scheme_id", "parent_comp"); if (CollectionUtils.isNotEmpty(items)) { addGroups.add(new SearchConditionGroup(extendTitle.getTitle(), true, items)); } @@ -286,7 +275,7 @@ public class JobServiceImpl extends Service implements JobService { List extendTitles = getExtendTitleMapper().getTitlesByGroupID(GROUP_ID); if (CollectionUtils.isNotEmpty(extendTitles)) { for (ExtendTitlePO extendTitle : extendTitles) { - List items = getExtService(user).getExtForm(user, EXTEND_TYPE + "", GROUP_ID.equals(Long.parseLong(groupId)) ? JCL_ORG_JOB : JCL_ORG_JOBEXT, viewAttr, id, extendTitle.getId().toString(), ""); + List items = getExtService(user).getExtForm(user, EXTEND_TYPE + "", GROUP_ID.equals(Long.parseLong(groupId)) ? JCL_ORG_JOB : JCL_ORG_JOBEXT, viewAttr, id, extendTitle.getId().toString(), "scheme_id", "parent_comp"); if (CollectionUtils.isNotEmpty(items)) { addGroups.add(new SearchConditionGroup(extendTitle.getTitle(), true, items)); } @@ -301,23 +290,6 @@ public class JobServiceImpl extends Service implements JobService { // 处理明细表 List> extendTables = getExtService(user).getExtendTables(user, EXTEND_TYPE, Long.parseLong(groupId), JCL_ORG_JOBEXT_DT1, id, viewAttr, false); - Map tableMap = new HashMap<>(); - tableMap.put("hide", false); - tableMap.put("tabname", "职等职级"); - Map tabinfoMap = new HashMap<>(); - List infoPOList = new ArrayList<>(); - infoPOList.add(ExtendInfoPO.builder().fieldName("gradeId").fieldNameDesc("职级").controlType(3).isrequired(1).browserType("161").customValue("[\"browser\",{\"value\":\"161\",\"valueSpan\":\"自定义单选\",\"replaceDatas\":[{\"id\":\"161\",\"name\":\"自定义单选\"}]},{\"value\":\"gradeBrowser\",\"valueSpan\":\"职级浏览按钮\",\"replaceDatas\":[{\"showname\":\"gradeBrowser\",\"shownamespan\":\"gradeBrowser\",\"namespan\":\"职级浏览按钮\",\"name\":\"职级浏览按钮\",\"showtypespan\":\"列表式\",\"randomFieldIdspan\":\"\",\"showtype\":\"1\",\"randomFieldId\":\"gradeBrowser\",\"id\":\"gradeBrowser\"}]}]").build()); - infoPOList.add(ExtendInfoPO.builder().fieldName("levelId").fieldNameDesc("职等").controlType(3).isrequired(1).browserType("162").customValue("[\"browser\",{\"value\":\"162\",\"valueSpan\":\"自定义多选\",\"replaceDatas\":[{\"id\":\"162\",\"name\":\"自定义多选\"}]},{\"value\":\"LevelBrowser\",\"valueSpan\":\"职等浏览按钮\",\"replaceDatas\":[{\"showname\":\"LevelBrowser\",\"shownamespan\":\"LevelBrowser\",\"namespan\":\"职等浏览按钮\",\"name\":\"职等浏览按钮\",\"showtypespan\":\"列表式\",\"randomFieldIdspan\":\"\",\"showtype\":\"1\",\"randomFieldId\":\"LevelBrowser\",\"id\":\"LevelBrowser\"}]}]").build()); - tabinfoMap.put("columns", ExtendInfoBO.convertInfoListToTable(user, infoPOList, viewAttr, false)); - tabinfoMap.put("rownum", "rownum"); - // 去除null 元素 - List maps = getJobDTMapper().listJobDTByMainID(id); - maps.removeIf(Objects::isNull); - tabinfoMap.put("datas", maps); - tableMap.put("tabinfo", tabinfoMap); - // 添加明细表 - extendTables.add(0, tableMap); - resultMap.put("tables", extendTables); Map apiDatas = new HashMap<>(); @@ -337,8 +309,9 @@ public class JobServiceImpl extends Service implements JobService { JobSearchParam searchParam = JSONObject.parseObject(JSONObject.toJSONString(params), JobSearchParam.class); params.put("is_key", null == searchParam.getIsKey() ? 0 : searchParam.getIsKey()); - DepartmentPO departmentPO = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptById(searchParam.getParentDept()); - params.put("parent_comp", departmentPO.getParentComp()); + // TODO 处理ec表关联关系 + //DepartmentPO departmentPO = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptById(searchParam.getParentDept()); + //params.put("parent_comp", departmentPO.getParentComp()); if (StringUtils.isBlank(params.get("show_order").toString())) { int maxShowOrder = getJobMapper().getMaxShowOrder(); params.put("show_order", maxShowOrder + 1); @@ -376,22 +349,13 @@ public class JobServiceImpl extends Service implements JobService { // 更新主表数据 params.put("is_key", searchParam.getIsKey()); - DepartmentPO departmentPO = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptById(searchParam.getParentDept()); - params.put("parent_comp", departmentPO.getParentComp()); + // TODO 处理ec表关联关系 + //DepartmentPO departmentPO = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptById(searchParam.getParentDept()); + //params.put("parent_comp", departmentPO.getParentComp()); getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_JOB, params, "", searchParam.getId()); - // 更新主表拓展表 getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_JOBEXT, params, groupId, searchParam.getId()); // 更新明细表 - getJobDTMapper().deleteByIds(searchParam.getId()); - int rowNum = Util.getIntValue((String) params.get("rownum")); - for (int i = 0; i < rowNum; i++) { - String levelId = (String) params.get("levelId_" + i); - String gradeId = (String) params.get("gradeId_" + i); - String levelIdspan = (String) params.get("levelIdspan_" + i); - String gradeIdspan = (String) params.get("gradeIdspan_" + i); - getJobDTMapper().insertIgnoreNull(JobDTPO.builder().levelId(levelId).gradeId(gradeId).levelIdspan(levelIdspan).gradeIdspan(gradeIdspan).mainId(searchParam.getId()).creator((long) user.getUID()).deleteType(0).createTime(new Date()).updateTime(new Date()).build()); - } getExtService(user).updateExtDT(user, EXTEND_TYPE, JCL_ORG_JOBEXT_DT1, params, searchParam.getId()); return searchParam.getId(); } diff --git a/src/com/engine/organization/service/impl/LogViewServiceImpl.java b/src/com/engine/organization/service/impl/LogViewServiceImpl.java new file mode 100644 index 00000000..c1d19862 --- /dev/null +++ b/src/com/engine/organization/service/impl/LogViewServiceImpl.java @@ -0,0 +1,124 @@ +package com.engine.organization.service.impl; + +import com.api.browser.bean.SearchConditionGroup; +import com.api.browser.bean.SearchConditionItem; +import com.api.browser.bean.SearchConditionOption; +import com.api.browser.util.ConditionType; +import com.cloudstore.eccom.result.WeaResultMsg; +import com.engine.core.impl.Service; +import com.engine.email.util.EmailCommonCondition; +import com.engine.email.util.EmailConditionItem; +import com.engine.organization.component.OrganizationWeaTable; +import com.engine.organization.entity.logview.param.LogViewSearchParam; +import com.engine.organization.entity.logview.vo.LogViewVO; +import com.engine.organization.service.LogViewService; +import com.engine.organization.util.OrganizationFormItemUtil; +import org.apache.commons.lang.StringUtils; +import weaver.general.TimeUtil; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @author:dxfeng + * @createTime: 2022/07/05 + * @version: 1.0 + */ +public class LogViewServiceImpl extends Service implements LogViewService { + + @Override + public Map listPage(LogViewSearchParam param) { + Map resultMap = new HashMap<>(); + OrganizationWeaTable table = new OrganizationWeaTable<>(user, LogViewVO.class); + String sqlWhere = buildSqlWhere(param); + table.setSqlwhere(sqlWhere); + WeaResultMsg result = new WeaResultMsg(false); + result.putAll(table.makeDataResult()); + result.success(); + resultMap.putAll(result.getResultMap()); + return resultMap; + } + + @Override + public Map getSearchCondition() { + Map apiDatas = new HashMap<>(); + List addGroups = new ArrayList<>(); + List conditionItems = new ArrayList<>(); + + // 操作者 + SearchConditionItem operatorId = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "操作者", "1", "operatorId", ""); + //操作时间 + SearchConditionItem dateItem = OrganizationFormItemUtil.dateItem(user,2,16,true,2,"操作时间","operateDate"); + + // 操作者部门 + SearchConditionItem departmentId = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "操作者部门", "161", "departmentId", "deptBrowser"); + // 操作者分部 + SearchConditionItem companyId = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "操作者分部", "161", "companyId", "compBrowser"); + + conditionItems.add(operatorId); + conditionItems.add(dateItem); + conditionItems.add(departmentId); + conditionItems.add(companyId); + + addGroups.add(new SearchConditionGroup("高级搜索条件", true, conditionItems)); + apiDatas.put("conditions", addGroups); + return apiDatas; + } + + @Override + public String showDetailById(Long id) { + return null; + } + + static class DateGroupData { + private String name; + private String value; + + public DateGroupData(String name, String value) { + this.name = name; + this.value = value; + } + + public String getName() { + return name; + } + + public String getValue() { + return value; + } + } + private String buildSqlWhere(LogViewSearchParam param) { + if (null == param) { + return ""; + } + String sqlWhere = " where delete_type = 0 "; + if (StringUtils.isNotBlank(param.getModuleType())) { + sqlWhere += " and operate_module = '" + param.getModuleType() + "'"; + } + if (null != param.getOperatorId()) { + sqlWhere += " and operator_id = '" + param.getOperatorId() + "'"; + } + if (null != param.getCompanyId()) { + sqlWhere += " and operator_id in (select id from hrmresource where subcompanyid1 = '" + param.getCompanyId() + "')"; + } + if (null != param.getDepartmentId()) { + sqlWhere += " and operator_id in (select id from hrmresource where departmentid = '" + param.getDepartmentId() + "')"; + } + if (StringUtils.isNotBlank(param.getOperateDate()) && !"-1".equals(param.getOperateDate())) { + if (!"6".equals(param.getOperateDate())) { + sqlWhere += " and create_time >= '" + TimeUtil.getDateByOption(param.getOperateDate() + "", "0") + " 00:00:00'"; + sqlWhere += " and create_time <= '" + TimeUtil.getDateByOption(param.getOperateDate() + "", "") + " 23:59:59'"; + } else { + if (StringUtils.isNotBlank(param.getStartDate())) { + sqlWhere += " and create_time >= '" + param.getStartDate() + "'"; + } + if (StringUtils.isNotBlank(param.getEndDate())) { + sqlWhere += " and create_time <= '" + param.getEndDate() + "'"; + } + } + } + return sqlWhere; + } +} diff --git a/src/com/engine/organization/service/impl/OrgChartServiceImpl.java b/src/com/engine/organization/service/impl/OrgChartServiceImpl.java new file mode 100644 index 00000000..2403be70 --- /dev/null +++ b/src/com/engine/organization/service/impl/OrgChartServiceImpl.java @@ -0,0 +1,249 @@ +package com.engine.organization.service.impl; + +import cn.hutool.core.date.DateField; +import cn.hutool.core.date.DateUtil; +import com.engine.core.impl.Service; +import com.engine.organization.service.OrgChartService; +import org.apache.commons.lang3.StringUtils; +import weaver.conn.RecordSet; +import weaver.hrm.User; + +import java.util.*; + +/** + * @className: OrgChartServiceImpl + * @author: dengjp + * @date: 2022/7/7 + * @description: 组织架构图ServiceImpl + **/ +public class OrgChartServiceImpl extends Service implements OrgChartService { + @Override + public Map getOptionCondition(Map request2Map, User user) { + RecordSet rs = new RecordSet(); + String type = (String) request2Map.get("type"); + rs.executeQuery("select id, companyname from HrmCompanyVirtual order by id"); + Map result = new HashMap<>(); + List> fclasslist = new ArrayList<>(); + Map defaultItem = new HashMap<>(); + defaultItem.put("id", "0"); + defaultItem.put("companyname", "行政维度"); + fclasslist.add(defaultItem); + while(rs.next()) { + Map item = new HashMap<>(); + item.put("id", rs.getString("id")); + item.put("companyname", rs.getString("companyname")); + fclasslist.add(item); + } + + rs.executeQuery("select id, fnumber, fname from jcl_org_map " +("company".equals(type) ? "where ftype in (0, 1, 2)" : "") +" order by ftype , id "); + List> companylist = new ArrayList<>(); + Map defaultCompanyItem = new HashMap<>(); + defaultCompanyItem.put("id", "0"); + defaultCompanyItem.put("fname", "集团"); + companylist.add(defaultCompanyItem); + while(rs.next()) { + Map item = new HashMap<>(); + item.put("id", rs.getString("id")); + item.put("fnumber", rs.getString("fnumber")); + item.put("fname", rs.getString("fname")); + companylist.add(item); + } + result.put("api_status", true); + result.put("fclasslist", fclasslist); + result.put("companylist", companylist); + return result; + } + + @Override + public Map getCompanyData(Map request2Map, User user) { + String date = (String) request2Map.get("date"); // 数据日期 + if(StringUtils.isBlank(date)) { + date = DateUtil.format( DateUtil.offset(new Date() , DateField.DAY_OF_MONTH, 1), "yyyy-MM-dd"); + } + + String fclass = (String) request2Map.get("fclass"); // 维度 + String root = (String) request2Map.get("root"); // 根节点 + String level = (String) request2Map.get("level"); // 显示层级 + if(StringUtils.isBlank(level)) { + level = "3"; + } + + String fisvitual = (String) request2Map.get("fisvitual"); // 是否显示虚拟组织 + if(StringUtils.isBlank(fisvitual)) { + fisvitual = "0"; + } + + String whereSql = " where 1 = 1 "; + whereSql += " and (fdatebegin <= '"+ date +"' and fdateend >= '"+ date +"') or (fdatebegin <= '"+ date +"' and fdateend is null ) "; + whereSql += " and fclass = " + fclass +" "; + + if("0".equals(fisvitual)) { + whereSql += " and fisvitual = 0 "; + }else { + whereSql += " and fisvitual in (0, 1) "; + } + + String whereItemSql = " "; + if("0".equals(root)) { // 集团的情况 + whereItemSql += " and ftype = 0 "; + } else { + whereItemSql += " and id = '" + root +"' "; + } + + // 获取根节点 + RecordSet rs = new RecordSet(); + rs.executeQuery("select id, fname, ftype, fparentid from jcl_org_map " + whereSql + whereItemSql); + List> list = new ArrayList<>(); + String id = null; + if(rs.next()) { + Map item = new HashMap<>(); + id = rs.getString("id"); + item.put("id", rs.getString("id")); + item.put("fname", rs.getString("fname")); + item.put("ftype", rs.getString("ftype")); + item.put("parentId", null); + list.add(item); + } + + int currentLevel = 1; + if(currentLevel + 1 <= Integer.parseInt(level)) { + findCompanyItemByParantId(id, currentLevel + 1, level, rs, list, whereSql); + } + + Map result = new HashMap<>(); + result.put("api_status", true); + result.put("data", list); + return result; + } + + private void findCompanyItemByParantId(String id, int currentLevel, String level, RecordSet rs, List> list, String whereSql) { + rs.executeQuery("select id, fname, ftype, fparentid from jcl_org_map " + whereSql + " and fparentid = " + id); + List> currentList = new ArrayList<>(); + while(rs.next()) { + Map item = new HashMap<>(); + item.put("id", rs.getString("id")); + item.put("fname", rs.getString("fname")); + item.put("ftype", rs.getString("ftype")); + item.put("parentId", rs.getString("fparentid")); + currentList.add(item); + } + + list.addAll(currentList); + + for (Map stringObjectMap : currentList) { + if(currentLevel + 1 <= Integer.parseInt(level)) { + findCompanyItemByParantId((String) stringObjectMap.get("id"), currentLevel + 1, level, rs, list, whereSql); + } + } + + } + + @Override + public Map getUserData(Map request2Map, User user) { + String date = (String) request2Map.get("date"); // 数据日期 + if(StringUtils.isBlank(date)) { + date = DateUtil.format( DateUtil.offset(new Date() , DateField.DAY_OF_MONTH, 1), "yyyy-MM-dd"); + } + + String fclass = (String) request2Map.get("fclass"); // 维度 + String root = (String) request2Map.get("root"); // 根节点 + String level = (String) request2Map.get("level"); // 显示层级 + if(StringUtils.isBlank(level)) { + level = "3"; + } + + String fisvitual = (String) request2Map.get("fisvitual"); // 是否显示虚拟组织 + if(StringUtils.isBlank(fisvitual)) { + fisvitual = "0"; + } + + String whereSql = " where 1 = 1 "; + whereSql += " and (t.fdatebegin <= '"+ date +"' and t.fdateend >= '"+ date +"') or (t.fdatebegin <= '"+ date +"' and t.fdateend is null ) "; + whereSql += " and t.fclass = " + fclass +" "; + + if("0".equals(fisvitual)) { + whereSql += " and t.fisvitual = 0 "; + }else { + whereSql += " and t.fisvitual in (0, 1) "; + } + + String whereItemSql = " "; + if("0".equals(root)) { // 集团的情况 + whereItemSql += " and t.ftype = 0 "; + } else { + whereItemSql += " and t.id = '" + root +"' "; + } + + // 获取根节点 + RecordSet rs = new RecordSet(); + rs.executeQuery("select t.id, t.fname, t.ftype, t.fparentid, t.fleadername, t.fleaderimg, t.fleaderjob, t.fplan, t.fonjob from jcl_org_map t " + whereSql + whereItemSql); + List> list = new ArrayList<>(); + String id = null; + if(rs.next()) { + Map item = new HashMap<>(); + id = rs.getString("id"); + item.put("id", rs.getString("id")); + item.put("fname", rs.getString("fname")); + item.put("ftype", rs.getString("ftype")); + item.put("parentId", null); + item.put("fleadername", rs.getString("fleadername")); + item.put("fleaderimg", rs.getString("fleaderimg")); + item.put("fleaderjob", rs.getString("fleaderjob")); + item.put("fplan", rs.getString("fplan")); + item.put("fonjob", rs.getString("fonjob")); + list.add(item); + } + + int currentLevel = 1; + if(currentLevel + 1 <= Integer.parseInt(level)) { + findUserItemByParantId(id, currentLevel + 1, level, rs, list, whereSql); + } + + Map result = new HashMap<>(); + result.put("api_status", true); + result.put("data", list); + return result; + } + + private void findUserItemByParantId(String id, int currentLevel, String level, RecordSet rs, List> list, String whereSql) { + rs.executeQuery("select t.id, t.fname, t.ftype, t.fparentid, t.fleadername, t.fleaderimg, t.fleaderjob, t.fplan, t.fonjob, t.fnumber from jcl_org_map t " + whereSql + " and t.fparentid = " + id); + List> currentList = new ArrayList<>(); + while(rs.next()) { + Map item = new HashMap<>(); + item.put("id", rs.getString("id")); + item.put("fname", rs.getString("fname")); + item.put("ftype", rs.getString("ftype")); + item.put("parentId", rs.getString("fparentid")); + item.put("fleadername", rs.getString("fleadername")); + item.put("fleaderimg", rs.getString("fleaderimg")); + item.put("fleaderjob", rs.getString("fleaderjob")); + item.put("fplan", rs.getString("fplan")); + item.put("fonjob", rs.getString("fonjob")); + item.put("fnumber", rs.getString("fnumber")); + currentList.add(item); + } + + for (Map stringObjectMap : currentList) { + if("4".equals(stringObjectMap.get("ftype"))) { // 员工信息 + rs.executeQuery("select id, mobile, homeaddress from hrmresource where id = ? ", stringObjectMap.get("fnumber")); + if(rs.next()) { + stringObjectMap.put("mobile", rs.getString("mobile")); + stringObjectMap.put("address", rs.getString("homeaddress")); + } + rs.executeQuery("select departmentname from hrmresource hrm \n" + + "left join hrmdepartment d\n" + + "on hrm.departmentid = d.id\n" + + "where hrm.id = ? ", stringObjectMap.get("fnumber")); + if(rs.next()) { + stringObjectMap.put("department", rs.getString("departmentname")); + } + + } + if(currentLevel + 1 <= Integer.parseInt(level)) { + findUserItemByParantId((String) stringObjectMap.get("id"), currentLevel + 1, level, rs, list, whereSql); + } + } + list.addAll(currentList); + + } +} diff --git a/src/com/engine/organization/service/impl/PostInfoServiceImpl.java b/src/com/engine/organization/service/impl/PostInfoServiceImpl.java index e5e8f9e3..227a34e9 100644 --- a/src/com/engine/organization/service/impl/PostInfoServiceImpl.java +++ b/src/com/engine/organization/service/impl/PostInfoServiceImpl.java @@ -22,7 +22,6 @@ import com.engine.organization.util.db.DBType; import com.engine.organization.util.db.MapperProxyFactory; import org.apache.commons.lang3.StringUtils; import weaver.conn.RecordSet; -import weaver.general.StringUtil; import weaver.general.Util; import java.util.*; @@ -143,7 +142,8 @@ public class PostInfoServiceImpl extends Service implements PostInfoService { // 编辑状态下赋值操作 String id = Util.null2String(params.get("id")); - if (!StringUtil.isEmpty(id)) { + String planId = Util.null2String(params.get("planId")); + if (StringUtils.isNotBlank(id)) { PostInfoPO postInfoPO = getPostInfoMapper().getPostInfoByID(Integer.parseInt(id)); OrganizationAssert.notNull(postInfoPO, "选择的数据不存在,或数据已删除"); @@ -161,6 +161,11 @@ public class PostInfoServiceImpl extends Service implements PostInfoService { postIdBrowser.setBrowserConditionParam(browserBean); // 编辑状态下,编号只读 // noItem.setViewAttr(1); + }else if(StringUtils.isNotBlank(planId)){ + BrowserBean browserBean = postIdBrowser.getBrowserConditionParam(); + List> maps = getPostMapper().listPostsByIds(DeleteParam.builder().ids(planId).build().getIds()); + browserBean.setReplaceDatas(maps); + postIdBrowser.setBrowserConditionParam(browserBean); } selectItems.add(noItem); diff --git a/src/com/engine/organization/service/impl/SchemeServiceImpl.java b/src/com/engine/organization/service/impl/SchemeServiceImpl.java index 1d312b1b..bc310091 100644 --- a/src/com/engine/organization/service/impl/SchemeServiceImpl.java +++ b/src/com/engine/organization/service/impl/SchemeServiceImpl.java @@ -60,20 +60,17 @@ public class SchemeServiceImpl extends Service implements SchemeService { } @Override - public Map save(SchemeSearchParam param) { + public int save(SchemeSearchParam param) { HasRightUtil.hasRight(user, RIGHT_NAME, false); - Map apidatas = new HashMap<>(16); List list = getSchemeMapper().listByNo(Util.null2String(param.getSchemeNo())); OrganizationAssert.isEmpty(list, "编号不允许重复"); SchemePO schemePO = SchemeDTO.convertParamToPO(param, (long) user.getUID()); - getSchemeMapper().insertIgnoreNull(schemePO); - return apidatas; + return getSchemeMapper().insertIgnoreNull(schemePO); } @Override - public Map updateScheme(SchemeSearchParam param) { + public int updateScheme(SchemeSearchParam param) { HasRightUtil.hasRight(user, RIGHT_NAME, false); - Map apidatas = new HashMap<>(); SchemePO schemePO = SchemeDTO.convertParamToPO(param, (long) user.getUID()); // 更新前先查询下旧编号, String oldSchemeNo = getSchemeMapper().getSchemeByID(schemePO.getId()).getSchemeNo(); @@ -81,23 +78,22 @@ public class SchemeServiceImpl extends Service implements SchemeService { List list = getSchemeMapper().listByNo(Util.null2String(schemePO.getSchemeNo())); OrganizationAssert.isEmpty(list, "编号不允许重复"); } - getSchemeMapper().updateScheme(schemePO); - return apidatas; + return getSchemeMapper().updateScheme(schemePO); } @Override - public void updateForbiddenTagById(SchemeSearchParam params) { + public int updateForbiddenTagById(SchemeSearchParam params) { HasRightUtil.hasRight(user, RIGHT_NAME, false); SchemePO schemePO = SchemePO.builder().id(params.getId()).forbiddenTag(params.getForbiddenTag() ? 0 : 1).build(); - getSchemeMapper().updateForbiddenTagById(schemePO); + return getSchemeMapper().updateForbiddenTagById(schemePO); } @Override - public void deleteByIds(Collection ids) { + public int deleteByIds(Collection ids) { HasRightUtil.hasRight(user, RIGHT_NAME, false); OrganizationAssert.notEmpty(ids, "请选择要删除的数据"); - getSchemeMapper().deleteByIds(ids); + return getSchemeMapper().deleteByIds(ids); } diff --git a/src/com/engine/organization/service/impl/StaffServiceImpl.java b/src/com/engine/organization/service/impl/StaffServiceImpl.java index 959095cb..26fc2f4b 100644 --- a/src/com/engine/organization/service/impl/StaffServiceImpl.java +++ b/src/com/engine/organization/service/impl/StaffServiceImpl.java @@ -202,7 +202,7 @@ public class StaffServiceImpl extends Service implements StaffService { selectOptions.add(option1); selectOptions.add(option2); selectOptions.add(option3); - SearchConditionItem controlPolicyItem = OrganizationFormItemUtil.selectItem(user, selectOptions, 2, 16, 6, false, "控制策略", "controlPolicy"); + SearchConditionItem controlPolicyItem = OrganizationFormItemUtil.selectItem(user, selectOptions, 2, 16, 6, true, "控制策略", "controlPolicy"); controlPolicyItem.setViewAttr(3); controlPolicyItem.setRules("required|string"); SearchConditionItem descriptionItem = OrganizationFormItemUtil.textareaItem(user, 2, 16, true, 2, 60, "描述说明", "description"); diff --git a/src/com/engine/organization/transmethod/HrmResourceTransMethod.java b/src/com/engine/organization/transmethod/HrmResourceTransMethod.java index 23d79f3c..4db898e0 100644 --- a/src/com/engine/organization/transmethod/HrmResourceTransMethod.java +++ b/src/com/engine/organization/transmethod/HrmResourceTransMethod.java @@ -2,7 +2,8 @@ package com.engine.organization.transmethod; import com.engine.organization.mapper.comp.CompMapper; import com.engine.organization.mapper.department.DepartmentMapper; -import com.engine.organization.mapper.employee.EmployeeMapper; +import com.engine.organization.mapper.hrmresource.HrmResourceMapper; +import com.engine.organization.mapper.hrmresource.SystemDataMapper; import com.engine.organization.util.db.MapperProxyFactory; /** @@ -21,6 +22,21 @@ public class HrmResourceTransMethod { } public static String getManagerName(String managerId) { - return MapperProxyFactory.getProxy(EmployeeMapper.class).getEmployeeNameById(Long.parseLong(managerId)); + return MapperProxyFactory.getProxy(HrmResourceMapper.class).getLastNameById(Long.parseLong(managerId)); + } + + public static String getScDepartmentName(String departmentId) { + return MapperProxyFactory.getProxy(SystemDataMapper.class).getScDepartmentNameById(departmentId); + } + + public static String getScCompanyName(String subCompanyId) { + return MapperProxyFactory.getProxy(SystemDataMapper.class).getScDepartmentNameById(subCompanyId); + } + + public static String getScManagerName(String managerId) { + if ("0".equals(managerId)) { + return ""; + } + return MapperProxyFactory.getProxy(SystemDataMapper.class).getScHrmResourceNameById(managerId); } } diff --git a/src/com/engine/organization/transmethod/LogViewTransMethod.java b/src/com/engine/organization/transmethod/LogViewTransMethod.java new file mode 100644 index 00000000..dbb2befa --- /dev/null +++ b/src/com/engine/organization/transmethod/LogViewTransMethod.java @@ -0,0 +1,65 @@ +package com.engine.organization.transmethod; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.serializer.SerializerFeature; +import com.engine.organization.enums.OperateTypeEnum; +import org.apache.commons.lang.StringUtils; + +/** + * @author:dxfeng + * @createTime: 2022/07/05 + * @version: 1.0 + */ +public class LogViewTransMethod { + + public String getOperateType(String operateType) { + if (StringUtils.isNotBlank(operateType)) { + switch (operateType) { + case "1": + operateType = OperateTypeEnum.ADD.getLabel(); + break; + case "2": + operateType = OperateTypeEnum.UPDATE.getLabel(); + break; + case "4": + operateType = OperateTypeEnum.DELETE.getLabel(); + break; + case "5": + operateType = OperateTypeEnum.MOVE.getLabel(); + break; + case "6": + operateType = OperateTypeEnum.MERGE.getLabel(); + break; + case "7": + operateType = OperateTypeEnum.COPY.getLabel(); + break; + default: + break; + } + return operateType; + } + return ""; + } + + public String getDateTimeFormat(String dateTime) { + if (StringUtils.isNotBlank(dateTime)) { + dateTime = dateTime.substring(0,19); + } + return dateTime; + } + + public static String getFormatJson(String jsonStr) { + if (StringUtils.isNotBlank(jsonStr)) { + try { + JSONObject object = JSONObject.parseObject(jsonStr); + jsonStr = JSON.toJSONString(object, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue, + SerializerFeature.WriteDateUseDateFormat); + jsonStr= jsonStr.replace("\n","
").replace("\t","    "); + } catch (Exception e) { + return jsonStr; + } + } + return jsonStr; + } +} diff --git a/src/com/engine/organization/util/LogAspect.java b/src/com/engine/organization/util/LogAspect.java index 41be247c..fbfb4eee 100644 --- a/src/com/engine/organization/util/LogAspect.java +++ b/src/com/engine/organization/util/LogAspect.java @@ -3,14 +3,12 @@ package com.engine.organization.util; import com.engine.organization.annotation.Log; import com.engine.organization.entity.LoggerContext; import com.engine.organization.enums.DeleteTypeEnum; -import com.engine.organization.mapper.SISLog.SISLogMapper; +import com.engine.organization.mapper.sislog.SISLogMapper; import com.engine.organization.util.db.MapperProxyFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.lang.reflect.Method; -import java.lang.reflect.Parameter; -import java.util.Arrays; import java.util.Date; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -21,7 +19,7 @@ import java.util.concurrent.Executors; * @Date 2022/4/27 * @Version V1.0 **/ -public class LogAspect { +public class LogAspect { Class clazz; @@ -32,7 +30,7 @@ public class LogAspect { private static final Logger logger = LoggerFactory.getLogger(LogAspect.class); - public LogAspect(Class clazz,Method method,LoggerContext loggerContext) { + public LogAspect(Class clazz, Method method, LoggerContext loggerContext) { this.clazz = clazz; this.method = method; this.loggerContext = loggerContext; @@ -46,17 +44,18 @@ public class LogAspect { boolean f = method.isAnnotationPresent(Log.class); if (f) { Log annotation = method.getAnnotation(Log.class); - Parameter[] parameters = method.getParameters(); String value = annotation.operateType().getValue(); String operateDesc = annotation.operateDesc(); + String operateModuleName = annotation.operateModule().getName(); + Integer operateModule = annotation.operateModule().getValue(); loggerContext.setOperateDesc(operateDesc); loggerContext.setCreateTime(new Date()); loggerContext.setOperateType(value); - loggerContext.setParamsStr(Arrays.toString(parameters)); - loggerContext.setClientIp("127.0.0.1"); loggerContext.setMethodName(method.getName()); loggerContext.setClassName(clazz.getName()); loggerContext.setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue()); + loggerContext.setOperateModuleName(operateModuleName); + loggerContext.setOperateModule(operateModule); MapperProxyFactory.getProxy(SISLogMapper.class).insert(loggerContext); } }); diff --git a/src/com/engine/organization/util/MenuBtn.java b/src/com/engine/organization/util/MenuBtn.java index b95ad66d..7ce1b077 100644 --- a/src/com/engine/organization/util/MenuBtn.java +++ b/src/com/engine/organization/util/MenuBtn.java @@ -154,7 +154,7 @@ public class MenuBtn { // 新增 rightMenuList.add(MenuBtn.rightMenu_addNew()); // 复制 - rightMenuList.add(MenuBtn.rightMenu_copy()); + // rightMenuList.add(MenuBtn.rightMenu_copy()); // 日志 rightMenuList.add(MenuBtn.rightMenu_btnLog()); btnDatas.put("rightMenu", rightMenuList); diff --git a/src/com/engine/organization/util/OrganizationDateUtil.java b/src/com/engine/organization/util/OrganizationDateUtil.java new file mode 100644 index 00000000..b4aa41a3 --- /dev/null +++ b/src/com/engine/organization/util/OrganizationDateUtil.java @@ -0,0 +1,460 @@ +package com.engine.organization.util; + +import com.engine.organization.common.LocalDateRange; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.math.NumberUtils; +import org.apache.commons.lang3.time.FastDateFormat; +import weaver.general.BaseBean; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.*; +import java.time.format.DateTimeFormatter; +import java.util.Calendar; +import java.util.Date; +import java.util.Objects; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + + +@Slf4j +public class OrganizationDateUtil { + + public static final ZoneId CTT = ZoneId.of(ZoneId.SHORT_IDS.get("CTT")); + public static final ZoneOffset SHANGHAI_ZONE_OFF_SET = ZoneOffset.ofHours(8); + + public static final FastDateFormat DATE_FORMAT = FastDateFormat.getInstance("yyyy-MM-dd"); + public static final FastDateFormat DATETIME_FORMAT = FastDateFormat.getInstance("yyyy-MM-dd HH:mm:ss"); + + public static final DateTimeFormatter MONTH_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM"); + public static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + public static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + + public static final String MONTH_FORMATTER_PATTERN = "yyyy-MM"; + public static final String DATE_FORMATTER_PATTERN = "yyyy-MM-dd"; + public static final String DATE_TIME_FORMATTER_PATTERN = "yyyy-MM-dd HH:mm:ss"; + /** + * yyyy-MM + **/ + private static final String MONTH_REGEX = "^([1-9]\\d{3})-(([0]{0,1}[1-9])|([1][0-2]))$"; + /** + * yyyy-MM-dd + **/ + private static final String DAY_REGEX = "^[1-9]\\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$"; + /** + * 含斜杠日期格式 + */ + private static final String DAY_BAR_REGEX = "^[1-9]\\d{3}/([1-9]|1[0-2])/([1-9]|[1-2][0-9]|3[0-1])$"; + + public static Long localDate2EpochMilli(LocalDate localDate) { + if (localDate == null) { + return NumberUtils.LONG_ZERO; + } + return localDate.atStartOfDay(ZoneId.systemDefault()).toInstant().toEpochMilli(); + } + + public static Long localDateTime2EpochMilli(LocalDateTime localDateTime) { + if (localDateTime == null) { + return NumberUtils.LONG_ZERO; + } + return localDateTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(); + } + + public static Long localDateTime2EpochMilli(Date localDateTime) { + if (localDateTime == null) { + return NumberUtils.LONG_ZERO; + } + return localDateTime.getTime(); + } + + public static String getFormatYearMonth(LocalDate localDate) { + if (localDate == null) { + return StringUtils.EMPTY; + } + try { + return localDate.format(MONTH_FORMATTER); + } catch (Exception e) { + log.warn("格式化月份错误", e); + return StringUtils.EMPTY; + } + } + + + public static String getFormatYearMonth(Date localDate) { + if (localDate == null) { + return StringUtils.EMPTY; + } + try { + SimpleDateFormat simpleDateFormat = new SimpleDateFormat(MONTH_FORMATTER_PATTERN); + return simpleDateFormat.format(localDate); + } catch (Exception e) { + log.warn("格式化月份错误", e); + return StringUtils.EMPTY; + } + } + + public static String getFormatLocalDate(LocalDate localDate) { + if (localDate == null) { + return StringUtils.EMPTY; + } + try { + return localDate.format(DATE_FORMATTER); + } catch (Exception e) { + log.warn("格式化日期错误", e); + return StringUtils.EMPTY; + } + } + + public static String getFormatLocalDate(LocalDateTime localDateTime) { + if (localDateTime == null) { + return StringUtils.EMPTY; + } + try { + return localDateTime.format(DATE_FORMATTER); + } catch (Exception e) { + log.warn("格式化日期错误", e); + return StringUtils.EMPTY; + } + } + + public static String getFormatLocalDateTime(LocalDateTime localDateTime) { + if (localDateTime == null) { + return StringUtils.EMPTY; + } + try { + return localDateTime.format(DATE_TIME_FORMATTER); + } catch (Exception e) { + log.warn("格式化日期错误", e); + return StringUtils.EMPTY; + } + } + + public static String getFormatLocalDateTime(Date localDateTime) { + if (localDateTime == null) { + return StringUtils.EMPTY; + } + try { + SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_TIME_FORMATTER_PATTERN); + return simpleDateFormat.format(localDateTime); + } catch (Exception e) { + log.warn("格式化日期错误", e); + return StringUtils.EMPTY; + } + } + + public static LocalDateTime dateToLocalDateTime(Date date) { + Instant instant = date.toInstant(); + ZoneId zone = ZoneId.systemDefault(); + return LocalDateTime.ofInstant(instant, zone); + } + + public static LocalDate dateToLocalDate(Date date) { + return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + } + + public static Date localDateToDate(LocalDate localDate) { + if (null == localDate) { + return null; + } + ZonedDateTime zonedDateTime = localDate.atStartOfDay(ZoneId.systemDefault()); + return Date.from(zonedDateTime.toInstant()); + } + + public static Date localDateTimeToDate(LocalDateTime localDateTime) { + if (null == localDateTime) { + return null; + } + return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant()); + } + + public static String getFormatLocalDate(Date date) { + if (date == null) { + return StringUtils.EMPTY; + } + LocalDateTime localDateTime = dateToLocalDateTime(date); + return getFormatLocalDate(localDateTime); + } + + public static YearMonth localDate2YearMonth(Date localDate) { + if (localDate == null) { + return null; + } + Calendar c = Calendar.getInstance(); + c.setTime(localDate); + int year = c.get(Calendar.YEAR); + int month = c.get(Calendar.MONTH) + 1; + return YearMonth.of(year, month); + } + + public static YearMonth String2YearMonth(String localDate) { + if (checkDay(localDate)) { + return null; + } + + return YearMonth.parse(localDate); + } + + public static LocalDateRange localDate2Range(Date localDate) { + if (localDate == null) { + return null; + } + return LocalDateRange.builder() + .fromDate(getFirstDayDateOfMonth(localDate)) + .endDate(getLastDayOfMonth(localDate)) + .build(); + } + + public static LocalDateRange localDate2YearRange(Date localDate) { + if (localDate == null) { + return null; + } + return LocalDateRange.builder() + .fromDate(getFirstDayDateOfYear(localDate)) + .endDate(getLastDayOfYear(localDate)) + .build(); + } + + public static Date getFirstDayDateOfMonth(final Date date) { + final Calendar cal = Calendar.getInstance(); + cal.setTime(date); + final int last = cal.getActualMinimum(Calendar.DAY_OF_MONTH); + cal.set(Calendar.DAY_OF_MONTH, last); + return cal.getTime(); + } + + public static Date getLastDayOfMonth(final Date date) { + final Calendar cal = Calendar.getInstance(); + cal.setTime(date); + final int last = cal.getActualMaximum(Calendar.DAY_OF_MONTH); + cal.set(Calendar.DAY_OF_MONTH, last); + return cal.getTime(); + } + + public static Date getFirstDayDateOfYear(final Date date) { + final Calendar cal = Calendar.getInstance(); + cal.setTime(date); + final int last = cal.getActualMinimum(Calendar.DAY_OF_YEAR); + cal.set(Calendar.DAY_OF_YEAR, last); + return cal.getTime(); + } + + public static Date getLastDayOfYear(final Date date) { + final Calendar cal = Calendar.getInstance(); + cal.setTime(date); + final int last = cal.getActualMaximum(Calendar.DAY_OF_YEAR); + cal.set(Calendar.DAY_OF_YEAR, last); + return cal.getTime(); + } + + public static String getMonthBegin(String specifiedDay) { + int year; + int month; + Pattern pattern = Pattern.compile("\\d+-\\d+"); + Matcher matcher = pattern.matcher(specifiedDay); + if (StringUtils.isEmpty(specifiedDay) || !matcher.matches()) { + return null; + } else { + year = Integer.parseInt(specifiedDay.split("-")[0]); + month = Integer.parseInt(specifiedDay.split("-")[1]); + } + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Calendar calendar = Calendar.getInstance(); + calendar.set(Calendar.YEAR, year); + calendar.set(Calendar.MONTH, month - 1); + calendar.set(Calendar.DAY_OF_MONTH, 1); + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + calendar.set(Calendar.MILLISECOND, 0); + Date startDate = calendar.getTime(); + return sdf.format(startDate); + } + + public static String getYearMonth(int yearNum, int monthNum) { + LocalDateTime dateTime = LocalDateTime.now(); + int year = dateTime.getYear() + yearNum; + int month = dateTime.getMonthValue() + monthNum; + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM"); + Calendar calendar = Calendar.getInstance(); + calendar.set(Calendar.YEAR, year); + calendar.set(Calendar.MONTH, month - 1); + calendar.set(Calendar.DAY_OF_MONTH, 1); + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + calendar.set(Calendar.MILLISECOND, 0); + Date startDate = calendar.getTime(); + return sdf.format(startDate); + } + + /** + * 检查年月格式 + * + * @param yearMonth + * @return + */ + public static boolean checkYearMonth(String yearMonth) { + return Pattern.matches(MONTH_REGEX, yearMonth); + } + + /** + * 检查日期格式 + * + * @param day + * @return + */ + public static boolean checkDay(String day) { + return Pattern.matches(DAY_REGEX, day) || Pattern.matches(DAY_BAR_REGEX, day); + } + + public static Date parse(String date, String pattern) { + SimpleDateFormat format = new SimpleDateFormat(pattern); + try { + return format.parse(date); + } catch (ParseException e) { + new BaseBean().writeLog(String.format("日期解析异常: %s, %s", date, pattern)); + } + return null; + } + + + /** + * LocalDate转YearMonth + * + * @param localDate + * @return + */ + public static YearMonth toYearMonth(LocalDate localDate) { + Objects.requireNonNull(localDate, "localDate"); + return YearMonth.of(localDate.getYear(), localDate.getMonthValue()); + } + + + /** + * YearMonth转Date + * 注意dayOfMonth范围:1到31之间,最大值根据月份确定特殊情况,如2月闰年29,非闰年28 + * 如果要转换为当月最后一天,可以使用下面方法:toDateEndOfMonth(YearMonth) + * + * @param yearMonth + * @param dayOfMonth + * @return + */ + public static Date toDate(YearMonth yearMonth, int dayOfMonth) { + Objects.requireNonNull(yearMonth, "yearMonth"); + return localDateToDate(yearMonth.atDay(dayOfMonth)); + } + + /** + * YearMonth转Date,转换为当月第一天 + * + * @param yearMonth + * @return + */ + public static Date toDateStartOfMonth(YearMonth yearMonth) { + return toDate(yearMonth, 1); + } + + /** + * YearMonth转Date,转换为当月最后一天 + * + * @param yearMonth + * @return + */ + public static Date toDateEndOfMonth(YearMonth yearMonth) { + Objects.requireNonNull(yearMonth, "yearMonth"); + return localDateToDate(yearMonth.atEndOfMonth()); + } + + + /** + * YearMonth转LocalDate + * 注意dayOfMonth范围:1到31之间,最大值根据月份确定特殊情况,如2月闰年29,非闰年28 + * 如果要转换为当月最后一天,可以使用下面方法:toLocalDateEndOfMonth(YearMonth) + * + * @param yearMonth + * @param dayOfMonth + * @return + */ + public static LocalDate toLocalDate(YearMonth yearMonth, int dayOfMonth) { + Objects.requireNonNull(yearMonth, "yearMonth"); + return yearMonth.atDay(dayOfMonth); + } + + /** + * YearMonth转LocalDate,转换为当月第一天 + * + * @param yearMonth + * @return + */ + public static LocalDate toLocalDateStartOfMonth(YearMonth yearMonth) { + return toLocalDate(yearMonth, 1); + } + + /** + * YearMonth转LocalDate,转换为当月最后一天 + * + * @param yearMonth + * @return + */ + public static LocalDate toLocalDateEndOfMonth(YearMonth yearMonth) { + Objects.requireNonNull(yearMonth, "yearMonth"); + return yearMonth.atEndOfMonth(); + } + + /** + * String转Date + * + * @param date + * @return + */ + public static Date stringToDateTime(String date) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + Date parse = null; + if (date != null) { + try { + parse = sdf.parse(date); + } catch (ParseException e) { + throw new RuntimeException(e); + } + } + return parse; + } + + public static Date stringToDate(String date) { + return dateStrToLocalDate(date); + } + + //格式化日期 + public static String strToDateLong(String strDate) { + Date date = new Date(); + try { + date = new SimpleDateFormat("yyyyMMddHHmmss").parse(strDate + "000000");//先按照原格式转换为时间 + } catch (ParseException e) { + e.printStackTrace(); + } + String str = new SimpleDateFormat("yyyy-MM").format(date);//再将时间转换为对应格式字符串 + return str; + } + + private static Date dateStrToLocalDate(String date) { + Date localDate = null; + try { + date = date.substring(0, 10); + if (date.contains("/")) { + SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd"); + localDate = format.parse(date); + } else if (date.contains("-")) { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + localDate = format.parse(date); + } + } catch (Exception e) { + log.error("日期解析异常,{}", date); + localDate = null; + } + + return localDate; + } +} + + diff --git a/src/com/engine/organization/util/OrganizationFormItemUtil.java b/src/com/engine/organization/util/OrganizationFormItemUtil.java index 3096622e..7f7daa2a 100644 --- a/src/com/engine/organization/util/OrganizationFormItemUtil.java +++ b/src/com/engine/organization/util/OrganizationFormItemUtil.java @@ -7,6 +7,7 @@ import com.api.browser.util.ConditionFactory; import com.api.browser.util.ConditionType; import weaver.hrm.User; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -236,7 +237,29 @@ public class OrganizationFormItemUtil { /** - * 日期 + * 日期组合 + * @param user + * @param colSpan + * @param fieldcol + * @param isQuickSearch + * @param viewAttr + * @param label + * @param name + * @return + */ + public static SearchConditionItem dateItem(User user, int colSpan, int fieldcol, boolean isQuickSearch, + int viewAttr, String label, String name) { + ConditionFactory conditionFactory = new ConditionFactory(user); + SearchConditionItem date = conditionFactory.createCondition(ConditionType.DATE, 502227, name); + date.setColSpan(colSpan); + date.setFieldcol(fieldcol); + date.setIsQuickSearch(isQuickSearch); + date.setViewAttr(viewAttr); + date.setLabel(label); + return date; + } + + /** * * @param user * @param colSpan @@ -260,4 +283,48 @@ public class OrganizationFormItemUtil { } + public static SearchConditionItem dateGroupItem(User user, int colSpan, int fieldcol, boolean isQuickSearch, + int viewAttr, String label, String name) { + ConditionFactory conditionFactory = new ConditionFactory(user); + SearchConditionItem dateGroup = conditionFactory.createCondition(ConditionType.DATEGROUP, 502227, name); + dateGroup.setColSpan(colSpan); + dateGroup.setFieldcol(fieldcol); + dateGroup.setIsQuickSearch(isQuickSearch); + dateGroup.setViewAttr(viewAttr); + dateGroup.setLabel(label); + List datas = new ArrayList<>(); + datas.add(new DateGroupData("全部","0")); + datas.add(new DateGroupData("今天","1")); + datas.add(new DateGroupData("本周","2")); + datas.add(new DateGroupData("本月","3")); + datas.add(new DateGroupData("本季","4")); + datas.add(new DateGroupData("本年","5")); + datas.add(new DateGroupData("上个月","7")); + datas.add(new DateGroupData("上一年","8")); + datas.add(new DateGroupData("指定日期范围","6")); + dateGroup.setDatas(datas); + dateGroup.setValue(new ArrayList<>()); + dateGroup.setDateGroup(true); + return dateGroup; + } + + static class DateGroupData{ + private String name; + private String value; + + public DateGroupData(String name, String value) { + this.name = name; + this.value = value; + } + + public String getName() { + return name; + } + + public String getValue() { + return value; + } + } + + } diff --git a/src/com/engine/organization/util/OrganizationWrapper.java b/src/com/engine/organization/util/OrganizationWrapper.java new file mode 100644 index 00000000..32ffa83b --- /dev/null +++ b/src/com/engine/organization/util/OrganizationWrapper.java @@ -0,0 +1,68 @@ +package com.engine.organization.util; + +import com.alibaba.fastjson.JSON; +import com.engine.core.impl.Service; +import com.engine.organization.entity.LoggerContext; +import com.engine.organization.entity.logview.bo.FieldBaseEquator; +import com.engine.organization.transmethod.LogViewTransMethod; +import org.apache.commons.collections.CollectionUtils; + +import java.lang.reflect.Method; +import java.util.List; + +/** + * @author:dxfeng + * @createTime: 2022/07/04 + * @version: 1.0 + */ +public class OrganizationWrapper extends Service { + + /** + * 记录操作日志 + * + * @param clazz 调用类 + * @param value 对象名称 + * @param params 传参 + * @param before 原始对象 + * @param after 更新后对象 + */ + public void writeOperateLog(Class clazz, String value, String params, + Object before, Object after) { + Method method = clazz.getEnclosingMethod(); + LoggerContext loggerContext; + if (null != before) { + String formatJson = LogViewTransMethod.getFormatJson(params); + if (null != after) { + FieldBaseEquator fieldBaseEquator = new FieldBaseEquator(); + List diffFields = fieldBaseEquator.getDiffFields(before, after); + if (CollectionUtils.isEmpty(diffFields)) { + return; + } + StringBuilder message = new StringBuilder(); + for (int i = 0; i < diffFields.size(); i++) { + message.append(i + 1).append(".").append(diffFields.get(i)).append("
"); + } + loggerContext = LoggerContext.builder().operatorId(user.getUID()).value(value).clientIp(user.getLoginip()).paramsStr(formatJson).operatorName(user.getLastname()).message(message.toString()).build(); + + } else { + loggerContext = LoggerContext.builder().operatorId(user.getUID()).value(value).clientIp(user.getLoginip()).paramsStr(formatJson).operatorName(user.getLastname()).message(JSON.toJSONString(before)).build(); + } + LogAspect logAspect = new LogAspect(clazz, method, loggerContext); + logAspect.start(); + } + } + + + /** + * @param clazz 调用类 + * @param value 对象名称 + * @param params 传参 + * @param message 日志描述信息 + */ + public void writeOperateLog(Class clazz, String value, String params, + String message) { + writeOperateLog(clazz, value, params, message, null); + } + + +} diff --git a/src/com/engine/organization/util/PageInfoSortUtil.java b/src/com/engine/organization/util/PageInfoSortUtil.java index 9146a6b8..79d267e0 100644 --- a/src/com/engine/organization/util/PageInfoSortUtil.java +++ b/src/com/engine/organization/util/PageInfoSortUtil.java @@ -21,7 +21,7 @@ public class PageInfoSortUtil { * @return */ public static String getSortSql(String sortParams) { - JSONArray jsonArray = JSONObject.parseArray(sortParams); + JSONArray jsonArray = JSONObject.parseArray(sortParams); if (CollectionUtils.isNotEmpty(jsonArray)) { JSONObject jsonObject = (JSONObject) jsonArray.get(0); String orderKey = upperCharToUnderLine(jsonObject.getString("orderkey")); @@ -54,4 +54,28 @@ public class PageInfoSortUtil { } return builder.toString(); } + + /** + * 下划线转驼峰 + * + * @param str + * @return + */ + public static String underlineToHump(String str) { + //正则匹配下划线及后一个字符,删除下划线并将匹配的字符转成大写 + Matcher matcher = Pattern.compile("_([a-z])").matcher(str); + StringBuffer sb = new StringBuffer(str); + if (matcher.find()) { + sb = new StringBuffer(); + //将当前匹配的子串替换成指定字符串,并且将替换后的子串及之前到上次匹配的子串之后的字符串添加到StringBuffer对象中 + //正则之前的字符和被替换的字符 + matcher.appendReplacement(sb, matcher.group(1).toUpperCase()); + //把之后的字符串也添加到StringBuffer对象中 + matcher.appendTail(sb); + } else { + //去除除字母之外的前面带的下划线 + return sb.toString().replaceAll("_", ""); + } + return underlineToHump(sb.toString()); + } } diff --git a/src/com/engine/organization/util/excel/BooleanEnum.java b/src/com/engine/organization/util/excel/BooleanEnum.java new file mode 100644 index 00000000..7a795f1b --- /dev/null +++ b/src/com/engine/organization/util/excel/BooleanEnum.java @@ -0,0 +1,41 @@ +package com.engine.organization.util.excel; + +public enum BooleanEnum { + + True0("是", Boolean.TRUE), + True1("Y", Boolean.TRUE), + True2("TRUE", Boolean.TRUE), + True3("1", Boolean.TRUE), + True4("YES", Boolean.TRUE), + True5("T", Boolean.TRUE), + False0("否", Boolean.FALSE), + False1("N", Boolean.FALSE), + False2("FALSE", Boolean.FALSE), + False3("0", Boolean.FALSE), + False4("NO", Boolean.FALSE), + False5("F", Boolean.FALSE); + + private String name; + private Boolean value; + + private BooleanEnum(String name, Boolean value) { + this.name = name; + this.value = value; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Boolean getValue() { + return value; + } + + public void setValue(Boolean value) { + this.value = value; + } +} diff --git a/src/com/engine/organization/util/excel/ExcelComment.java b/src/com/engine/organization/util/excel/ExcelComment.java new file mode 100644 index 00000000..3d0669b6 --- /dev/null +++ b/src/com/engine/organization/util/excel/ExcelComment.java @@ -0,0 +1,111 @@ +package com.engine.organization.util.excel; + +/** + * 注释 + */ +public class ExcelComment { + int dx1 = 0; + int dy1 = 0; + int dx2 = 0; + int dy2 = 0; + int col1 = 0; + int row1 = 0; + int col2 = 0; + int row2 = 0; + String content; + + public int getDx1() { + return dx1; + } + + public void setDx1(int dx1) { + this.dx1 = dx1; + } + + public int getDy1() { + return dy1; + } + + public void setDy1(int dy1) { + this.dy1 = dy1; + } + + public int getDx2() { + return dx2; + } + + public void setDx2(int dx2) { + this.dx2 = dx2; + } + + public int getDy2() { + return dy2; + } + + public void setDy2(int dy2) { + this.dy2 = dy2; + } + + public int getCol1() { + return col1; + } + + public void setCol1(int col1) { + this.col1 = col1; + } + + public int getRow1() { + return row1; + } + + public void setRow1(int row1) { + this.row1 = row1; + } + + public int getCol2() { + return col2; + } + + public void setCol2(int col2) { + this.col2 = col2; + } + + public int getRow2() { + return row2; + } + + public void setRow2(int row2) { + this.row2 = row2; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public ExcelComment(int dx1, int dy1, int dx2, int dy2, int col1, int row1, int col2, int row2, String content) { + this.dx1 = dx1; + this.dy1 = dy1; + this.dx2 = dx2; + this.dy2 = dy2; + this.col1 = col1; + this.row1 = row1; + this.col2 = col2; + this.row2 = row2; + this.content = content; + } + + public ExcelComment(int col1, int row1, int col2, int row2, String content) { + this.col1 = col1; + this.row1 = row1; + this.col2 = col2; + this.row2 = row2; + this.content = content; + } + + public ExcelComment() { + } +} diff --git a/src/com/engine/organization/util/excel/ExcelParseException.java b/src/com/engine/organization/util/excel/ExcelParseException.java new file mode 100644 index 00000000..7a246aa9 --- /dev/null +++ b/src/com/engine/organization/util/excel/ExcelParseException.java @@ -0,0 +1,36 @@ +package com.engine.organization.util.excel; +import org.apache.commons.lang3.exception.ContextedRuntimeException; + +public class ExcelParseException extends ContextedRuntimeException{ + + private static final long serialVersionUID = -8696742623977630854L; + + public ExcelParseException(String message) { + super(message); + this.msgCode = DEFAULT_CODE; + } + + public ExcelParseException(String message, Throwable cause) { + super(message, cause); + this.msgCode = DEFAULT_CODE; + } + + /** + * 默认异常编码 + */ + private static final String DEFAULT_CODE = "EXCP0000"; + + /** + * 异常编码 + */ + private String msgCode; + + public String getMsgCode() { + return msgCode; + } + + public void setMsgCode(String msgCode) { + this.msgCode = msgCode; + } + +} diff --git a/src/com/engine/organization/util/excel/ExcelParseHelper.java b/src/com/engine/organization/util/excel/ExcelParseHelper.java new file mode 100644 index 00000000..6a4bd001 --- /dev/null +++ b/src/com/engine/organization/util/excel/ExcelParseHelper.java @@ -0,0 +1,262 @@ +package com.engine.organization.util.excel; + +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.Validate; +import org.apache.commons.lang3.exception.ContextedRuntimeException; +import org.apache.poi.ss.usermodel.Sheet; +import org.springframework.web.multipart.MultipartFile; + +import java.io.InputStream; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.*; + +import static com.engine.organization.util.excel.ExcelSupport.EXCEL_TYPE_XLSX; + +/** + * Excel 解析工具类 + **/ +public class ExcelParseHelper { + + //待校验的行号 + private static final int PARSE_EXCEL_ROW_VALID_CELL_INDEX = 0; + //字符开始下标 + private static final int CHARACTER_FIRST_INDEX = 0; + + /** + * 将 Excel 解析为 JavaBean 对象 + * + * @param file excel文件 + * @param clazz 解析bean的类 + * @param sheetIndex excel中第几个sheet,从0开始 + * @param rowIndex 从第几行开始解析,第一行是0 + * @param standardCellNum 模板验证,该sheet应有多少列 + * @return + */ + public static List parse2Map(MultipartFile file, Class clazz, int sheetIndex, int rowIndex, int standardCellNum) { + List> result = parse2Map(file, sheetIndex, rowIndex, standardCellNum); + List list = new ArrayList(); + for (List rowDatas : result) { + T t = setField(clazz, rowDatas); + list.add(t); + } + return list; + } + + /** + * 将 Excel 解析为 JavaBean 对象 + * + * @param file excel文件 + * @param clazz 解析bean的类 + * @param sheetIndex excel中第几个sheet,从0开始 + * @param rowIndex 从第几行开始解析,第一行是0 + * @param standardCellNum 模板验证,该sheet应有多少列 + * @param fileName 文件名 + * @return + */ + public static List parse2Map(InputStream file, Class clazz, int sheetIndex, int rowIndex, int standardCellNum, String fileName) { + List> result = parse2Map(file, sheetIndex, rowIndex, standardCellNum, fileName); + List list = new ArrayList(); + for (List rowDatas : result) { + T t = setField(clazz, rowDatas); + list.add(t); + } + return list; + } + + /** + * 获取excel数据。 + * + * @param file 文件 + * @param sheetIndex 解析第几个sheet + * @param rowIndex 从第几行开始解析,第一行为 0,依次类推 + * @return 二维数据集合 + */ + private static List> parse2Map(MultipartFile file, int sheetIndex, int rowIndex, int standardCellNum) { + Sheet sheet = ExcelSupport.parseFile(file, sheetIndex); + int rowCount = sheet.getPhysicalNumberOfRows(); // 总行数 + int cellCount = sheet.getRow(PARSE_EXCEL_ROW_VALID_CELL_INDEX).getPhysicalNumberOfCells(); // 总列数 + + Validate.isTrue(standardCellNum == cellCount, "Error in excel template! Page %s sheet should have %s column data, existing in %s column , please check the template!", sheetIndex, standardCellNum, cellCount); + + List> result = new ArrayList>(); + for (; rowIndex < rowCount; rowIndex++) { + List cellResult = new ArrayList(); + for (int j = 0; j < cellCount; j++) { + cellResult.add(ExcelSupport.getCellValue(sheet, rowIndex, j)); + } + result.add(cellResult); + } + return result; + } + + /** + * 获取excel数据。 + * + * @param file 文件 + * @param sheetIndex 解析第几个sheet + * @param rowIndex 从第几行开始解析,第一行为 0,依次类推 + * @return 二维数据集合 + */ + private static List> parse2Map(InputStream file, int sheetIndex, int rowIndex, int standardCellNum, String fileName) { + Sheet sheet = ExcelSupport.parseFile(file, sheetIndex, fileName); + int rowCount = sheet.getPhysicalNumberOfRows(); // 总行数 + int cellCount = sheet.getRow(PARSE_EXCEL_ROW_VALID_CELL_INDEX).getPhysicalNumberOfCells(); // 总列数 + + Validate.isTrue(standardCellNum == cellCount, "Error in excel template! Page %s sheet should have %s column data, existing in %s column , please check the template!", sheetIndex, standardCellNum, cellCount); + + List> result = new ArrayList>(); + for (; rowIndex < rowCount; rowIndex++) { + List cellResult = new ArrayList(); + for (int j = 0; j < cellCount; j++) { + cellResult.add(ExcelSupport.getCellValue(sheet, rowIndex, j)); + } + result.add(cellResult); + } + return result; + } + + + /** + * 将sheet数据转为map + * + * @param file + * @param sheetIndex sheet下标 + * @param rowIndex 从哪行开始解析 + * @return + */ + public static List> parse2Map(InputStream file, int sheetIndex, int rowIndex) { + Sheet sheet = ExcelSupport.parseFile(file, sheetIndex, EXCEL_TYPE_XLSX); + int rowCount = sheet.getPhysicalNumberOfRows(); // 总行数 + int cellCount = sheet.getRow(PARSE_EXCEL_ROW_VALID_CELL_INDEX).getPhysicalNumberOfCells(); // 总列数 + + List sheetHeader = ExcelSupport.getSheetHeader(sheet, PARSE_EXCEL_ROW_VALID_CELL_INDEX); + + List> result = new ArrayList<>(); + for (; rowIndex < rowCount; rowIndex++) { + Map cellResult = new HashMap<>(); + for (int j = 0; j < cellCount; j++) { + String key = sheetHeader.get(j); + cellResult.put(key, ExcelSupport.getCellValue(sheet, rowIndex, j)); + } + result.add(cellResult); + } + return result; + } + + + /** + * 将sheet数据转为map + * + * @param rowIndex 从哪行开始解析 + * @return + */ + public static List> parse2Map(Sheet sheet, int rowIndex) { + int rowCount = sheet.getPhysicalNumberOfRows(); // 总行数 + int cellCount = sheet.getRow(PARSE_EXCEL_ROW_VALID_CELL_INDEX).getPhysicalNumberOfCells(); // 总列数 + + List sheetHeader = ExcelSupport.getSheetHeader(sheet, PARSE_EXCEL_ROW_VALID_CELL_INDEX); + + List> result = new ArrayList<>(); + for (; rowIndex < rowCount; rowIndex++) { + Map cellResult = new HashMap<>(); + for (int j = 0; j < cellCount; j++) { + String key = sheetHeader.get(j); + cellResult.put(key, ExcelSupport.getCellValue(sheet, rowIndex, j)); + } + result.add(cellResult); + } + return result; + } + + /** + * 将sheet数据转为List + * + * @param rowIndex 从哪行开始解析 + * @return + */ + public static List> parse2List(Sheet sheet, int rowIndex) { + int rowCount = sheet.getPhysicalNumberOfRows(); // 总行数 + int cellCount = sheet.getRow(PARSE_EXCEL_ROW_VALID_CELL_INDEX).getPhysicalNumberOfCells(); // 总列数 + + List> result = new ArrayList>(); + for (; rowIndex < rowCount; rowIndex++) { + List cellResult = new ArrayList(); + for (int j = 0; j < cellCount; j++) { + cellResult.add(ExcelSupport.getCellValue(sheet, rowIndex, j)); + } + result.add(cellResult); + } + return result; + } + + + /** + * 为对象的每一个属性赋值 + * + * @param clazz + * @param rowDatas + * @param + * @return + */ + private static T setField(Class clazz, List rowDatas) { + try { + T obj = clazz.newInstance(); + Field[] fields = clazz.getDeclaredFields(); + for (Field field : fields) { + ExcelProperty excelProperty = field.getAnnotation(ExcelProperty.class); + if (excelProperty == null) { + continue; + } + int index = excelProperty.index(); + Object value = getFieldValue(field, rowDatas.get(index), excelProperty); + field.setAccessible(true); + field.set(obj, value); + } + return obj; + } catch (Exception e) { + throw new ExcelParseException(e.getMessage(), e); + } + } + + /** + * 获取javaBean属性值 + * + * @param field javaBean的对象属性 + * @param value excel中对应的值 + * @param excelProperty javaBean中解析excel注解,包含日期格式、错误提示信息 + * @return + */ + @SuppressWarnings("rawtypes") + private static Object getFieldValue(Field field, String value, ExcelProperty excelProperty) { + if (StringUtils.isEmpty(value)) { + return null; + } + Object val = null; + try { + Class typeClass = field.getType(); + if (typeClass == Integer.class) { + val = Integer.valueOf(value); + } else if (typeClass == Long.class) { + val = Long.valueOf(value); + } else if (typeClass == Float.class) { + val = Float.valueOf(value); + } else if (typeClass == Double.class) { + val = Double.valueOf(value); + } else if (typeClass == Date.class) { + val = ExcelSupport.getDate(value, excelProperty.format()); + } else if (typeClass == Short.class) { + val = Short.valueOf(value); + } else if (typeClass == Character.class) { + val = value.charAt(CHARACTER_FIRST_INDEX); + } else if (typeClass == BigDecimal.class) { + val = new BigDecimal(value); + } else { + val = value; + } + } catch (Exception e) { + throw new ContextedRuntimeException(excelProperty.msg(), e); + } + return val; + } +} diff --git a/src/com/engine/organization/util/excel/ExcelProperty.java b/src/com/engine/organization/util/excel/ExcelProperty.java new file mode 100644 index 00000000..eccf1396 --- /dev/null +++ b/src/com/engine/organization/util/excel/ExcelProperty.java @@ -0,0 +1,15 @@ +package com.engine.organization.util.excel; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface ExcelProperty { + public int index(); // 指定 JavaBean 的属性对应 excel 的第几列 + public String format() default "yyyy-MM-dd"; // 当 JavaBean 的属性为 Date 类型时,指定 Date 的格式化模式 + public String msg() default "解析错误";//当因excel中数据格式错误而造成的解析异常时,提示的错误信息 +} diff --git a/src/com/engine/organization/util/excel/ExcelSupport.java b/src/com/engine/organization/util/excel/ExcelSupport.java new file mode 100644 index 00000000..2d307995 --- /dev/null +++ b/src/com/engine/organization/util/excel/ExcelSupport.java @@ -0,0 +1,158 @@ +package com.engine.organization.util.excel; + +import org.apache.commons.lang3.Validate; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.web.multipart.MultipartFile; + +import java.io.BufferedInputStream; +import java.io.InputStream; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.Iterator; +import java.util.List; + +import static org.apache.poi.ss.usermodel.CellType.STRING; + + +public class ExcelSupport { + + private static final String pattern = "yyyy-MM-dd HH:mm:ss"; + + //excel类型 + public static final String EXCEL_TYPE_XLSX = "xlsx"; + public static final String EXCEL_TYPE_XLS = "xls"; + + + /** + * 解析文件,获取单个sheet + * + * @param file 文件 + * @param sheetIndex sheet下标,从0开始 + * @return sheet + */ + public static Sheet parseFile(MultipartFile file, int sheetIndex) { + Workbook workBook = null; + try (InputStream ins = file.getInputStream();) { + String fileName = file.getOriginalFilename(); + if (fileName.endsWith(EXCEL_TYPE_XLSX)) { + workBook = new XSSFWorkbook(ins); + } else if (fileName.endsWith(EXCEL_TYPE_XLS)) { + workBook = new HSSFWorkbook(ins); + } else { + throw new IllegalArgumentException("File format error! Only xlsx and xls types are supported"); + } + return workBook.getSheetAt(sheetIndex); + } catch (Exception e) { + throw new IllegalArgumentException(e); + } + } + + /** + * 解析文件,获取单个sheet + * + * @param sheetIndex sheet下标,从0开始 + * @return sheet + */ + public static Sheet parseFile(InputStream ins, int sheetIndex,String fileName) { + Workbook workBook = null; + try { + if (fileName.endsWith(EXCEL_TYPE_XLSX)) { + workBook = new XSSFWorkbook(new BufferedInputStream(ins)); + } else if (fileName.endsWith(EXCEL_TYPE_XLS)) { + workBook = new HSSFWorkbook(new BufferedInputStream(ins)); + } else { + throw new IllegalArgumentException("File format error! Only xlsx and xls types are supported"); + } + return workBook.getSheetAt(sheetIndex); + } catch (Exception e) { + throw new IllegalArgumentException(e); + } + } + + /** + * 获取sheet的头列 + * + * @param sheet + * @param headerIndex 头下标 + * @return + */ + public static List getSheetHeader(Sheet sheet, int headerIndex) { + List headers = new ArrayList<>(); + Row headerRow = sheet.getRow(headerIndex); + Iterator cellIterator = headerRow.cellIterator(); + while (cellIterator.hasNext()) { + Cell cell = (Cell) cellIterator.next(); + String stringCellValue = cell.getStringCellValue(); + headers.add(stringCellValue); + } + return headers; + } + + + /** + * 返回指定单元格的数据 + * + * @param sheet 指定sheet + * @param rowIndex 第几行,从0开始 + * @param cellIndex 第几列,从0开始 + * @return 值 + */ + public static String getCellValue(Sheet sheet, int rowIndex, int cellIndex) { + Validate.notNull(sheet.getRow(rowIndex), "Line %s is empty and cannot be resolved", rowIndex); + return getCellValue(sheet.getRow(rowIndex).getCell(cellIndex)); + } + + /** + * 格式化解析的数据 + */ + public static String getCellValue(Cell cell) { + String cellValue = ""; + if (cell != null) { + switch (cell.getCellType()) { + case NUMERIC: // 数值类型 + if (DateUtil.isCellDateFormatted(cell)) { + cellValue = getDateStr(cell.getDateCellValue(), pattern); + } else { + cell.setCellType(STRING); + cellValue = cell.getStringCellValue(); + } + break; + case STRING: // 字符串类型 + cellValue = cell.getStringCellValue(); + break; + case BOOLEAN: // 布尔类型 + cellValue = String.valueOf(cell.getBooleanCellValue()); + break; + case FORMULA: // 公式类型 + cellValue = String.valueOf(cell.getCellFormula()); + break; + case BLANK: // 空白类型 + cellValue = ""; + break; + case ERROR: + cellValue = ""; + break; + default: + cellValue = cell.toString().trim(); + break; + } + } + return cellValue.trim(); + } + + public static Date getDate(String dateStr, String pattern) { + try { + return new SimpleDateFormat(pattern).parse(dateStr); + } catch (ParseException e) { + throw new IllegalArgumentException(e); + } + } + + private static String getDateStr(Date date, String pattern) { + return new SimpleDateFormat(pattern).format(date); + } +} diff --git a/src/com/engine/organization/util/excel/ExcelUtil.java b/src/com/engine/organization/util/excel/ExcelUtil.java new file mode 100644 index 00000000..0a9f0acc --- /dev/null +++ b/src/com/engine/organization/util/excel/ExcelUtil.java @@ -0,0 +1,196 @@ +package com.engine.organization.util.excel; + +import com.engine.organization.util.OrganizationDateUtil; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.poi.ss.usermodel.CellType; +import org.apache.poi.ss.usermodel.FillPatternType; +import org.apache.poi.ss.usermodel.HorizontalAlignment; +import org.apache.poi.ss.usermodel.IndexedColors; +import org.apache.poi.xssf.usermodel.*; + +import java.util.Date; +import java.util.List; + +public class ExcelUtil { + /** + * 生成excel + * + * @param rowList + * @return + */ + public static XSSFWorkbook genWorkbook(List> rowList, String sheetName) { + XSSFWorkbook workbook = new XSSFWorkbook(); + + // 设置title样式 + XSSFCellStyle titleCellStyle = workbook.createCellStyle(); + XSSFFont titleFont = workbook.createFont(); + titleFont.setFontName("仿宋"); + titleFont.setFontHeightInPoints((short) 15); + titleCellStyle.setFont(titleFont); + titleCellStyle.setAlignment(HorizontalAlignment.CENTER); + titleCellStyle.setFillForegroundColor(IndexedColors.GREEN.getIndex());//背景色 + titleCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); + + + // 设置主体样式 + XSSFCellStyle cellStyle = workbook.createCellStyle(); + XSSFFont font = workbook.createFont(); + font.setFontName("宋体"); + font.setFontHeightInPoints((short) 10);// 设置字体大小 + cellStyle.setFont(font);// 选择需要用到的字体格式 + cellStyle.setWrapText(true); + + XSSFSheet sheet = workbook.createSheet(sheetName); + //自适应宽度 + sheet.autoSizeColumn(0, true); + //默认列宽 + sheet.setDefaultColumnWidth(40); + //默认行高 + sheet.setDefaultRowHeightInPoints(18); + + for (int rowIndex = 0; rowIndex < rowList.size(); rowIndex++) { + List infoList = rowList.get(rowIndex); + XSSFRow row = sheet.createRow(rowIndex); + for (int cellIndex = 0; cellIndex < infoList.size(); cellIndex++) { + XSSFCell cell = row.createCell(cellIndex); + cell.setCellType(CellType.STRING); + if (rowIndex == 0) { + cell.setCellStyle(titleCellStyle); + } else { + cell.setCellStyle(cellStyle); + } + cell.setCellValue(infoList.get(cellIndex)); +// sheet.setColumnWidth(cellIndex, 35 * 256); + } + } + return workbook; + } + + + public static XSSFWorkbook genWorkbookV2(List> rowList, String sheetName) { + XSSFWorkbook workbook = new XSSFWorkbook(); + + // 设置title样式 + XSSFCellStyle titleCellStyle = workbook.createCellStyle(); + XSSFFont titleFont = workbook.createFont(); + titleFont.setFontName("仿宋"); + titleFont.setFontHeightInPoints((short) 15); + titleCellStyle.setFont(titleFont); + titleCellStyle.setAlignment(HorizontalAlignment.CENTER); + titleCellStyle.setFillForegroundColor(IndexedColors.GREEN.getIndex());//背景色 + titleCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); + + + // 设置主体样式 + XSSFCellStyle cellStyle = workbook.createCellStyle(); + XSSFFont font = workbook.createFont(); + font.setFontName("宋体"); + font.setFontHeightInPoints((short) 10);// 设置字体大小 + cellStyle.setFont(font);// 选择需要用到的字体格式 + cellStyle.setWrapText(true); + + XSSFSheet sheet = workbook.createSheet(sheetName); + //自适应宽度 + sheet.autoSizeColumn(0, true); + //默认列宽 + sheet.setDefaultColumnWidth(25); + //默认行高 + sheet.setDefaultRowHeightInPoints(18); + + for (int rowIndex = 0; rowIndex < rowList.size(); rowIndex++) { + List infoList = rowList.get(rowIndex); + XSSFRow row = sheet.createRow(rowIndex); + for (int cellIndex = 0; cellIndex < infoList.size(); cellIndex++) { + XSSFCell cell = row.createCell(cellIndex); + if (rowIndex == 0) { + cell.setCellStyle(titleCellStyle); + } else { + cell.setCellStyle(cellStyle); + } + Object o = infoList.get(cellIndex); + if (o instanceof String) { + cell.setCellType(CellType.STRING); + cell.setCellValue(String.valueOf(o)); + } else if (o instanceof Boolean) { + cell.setCellType(CellType.BOOLEAN); + cell.setCellValue(String.valueOf(o)); + } else if (o instanceof Date) { + cell.setCellType(CellType.STRING); + cell.setCellValue(OrganizationDateUtil.getFormatLocalDate((Date) o)); + } else { + cell.setCellType(CellType.STRING); + cell.setCellValue(o == null ? "" : o.toString()); + } + } + } + return workbook; + } + + + public static XSSFWorkbook genWorkbookV2(List> rowList, String sheetName, List comments) { + XSSFWorkbook workbook = new XSSFWorkbook(); + + // 设置title样式 + XSSFCellStyle titleCellStyle = workbook.createCellStyle(); + XSSFFont titleFont = workbook.createFont(); + titleFont.setFontName("仿宋"); + titleFont.setFontHeightInPoints((short) 15); + titleCellStyle.setFont(titleFont); + titleCellStyle.setAlignment(HorizontalAlignment.CENTER); + titleCellStyle.setFillForegroundColor(IndexedColors.GREEN.getIndex());//背景色 + titleCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); + + + // 设置主体样式 + XSSFCellStyle cellStyle = workbook.createCellStyle(); + XSSFFont font = workbook.createFont(); + font.setFontName("宋体"); + font.setFontHeightInPoints((short) 10);// 设置字体大小 + cellStyle.setFont(font);// 选择需要用到的字体格式 + cellStyle.setWrapText(true); + + XSSFSheet sheet = workbook.createSheet(sheetName); + //自适应宽度 + sheet.autoSizeColumn(0, true); + //默认列宽 + sheet.setDefaultColumnWidth(20); + //默认行高 + sheet.setDefaultRowHeightInPoints(18); + + for (int rowIndex = 0; rowIndex < rowList.size(); rowIndex++) { + List infoList = rowList.get(rowIndex); + XSSFRow row = sheet.createRow(rowIndex); + for (int cellIndex = 0; cellIndex < infoList.size(); cellIndex++) { + XSSFCell cell = row.createCell(cellIndex); + if (rowIndex == 0) { + cell.setCellStyle(titleCellStyle); + } else { + cell.setCellStyle(cellStyle); + } + Object o = infoList.get(cellIndex); + if (o instanceof String) { + cell.setCellType(CellType.STRING); + cell.setCellValue(String.valueOf(o)); + } else if (o instanceof Boolean) { + cell.setCellType(CellType.BOOLEAN); + cell.setCellValue(String.valueOf(o)); + } else if (o instanceof Date) { + cell.setCellType(CellType.STRING); + cell.setCellValue(OrganizationDateUtil.getFormatLocalDate((Date) o)); + } else { + cell.setCellType(CellType.STRING); + cell.setCellValue(String.valueOf(o)); + } + } + } + + if (CollectionUtils.isNotEmpty(comments)) { + for (ExcelComment c : comments) { + XSSFDrawing patr = sheet.createDrawingPatriarch(); + XSSFComment cellComment = patr.createCellComment(new XSSFClientAnchor(c.dx1, c.dy1, c.dx2, c.dy2, c.col1, c.row1, c.col2, c.row2)); + cellComment.setString(c.content); + } + } + return workbook; + } +} diff --git a/src/com/engine/organization/util/response/ReturnResult.java b/src/com/engine/organization/util/response/ReturnResult.java index f011e61f..53544000 100644 --- a/src/com/engine/organization/util/response/ReturnResult.java +++ b/src/com/engine/organization/util/response/ReturnResult.java @@ -6,9 +6,12 @@ package com.engine.organization.util.response; * @Date 2022/4/26 * @Version V1.0 **/ + +import weaver.general.BaseBean; + import java.io.Serializable; -public class ReturnResult implements Serializable { +public class ReturnResult implements Serializable { private static final long serialVersionUID = 1L; private long code; @@ -16,8 +19,8 @@ public class ReturnResult implements Serializable { private String msg; public ReturnResult() { - this.code= ResultCode.SUCCESS.getCode(); - this.msg= ResultCode.SUCCESS.getMessage(); + this.code = ResultCode.SUCCESS.getCode(); + this.msg = ResultCode.SUCCESS.getMessage(); } /** @@ -34,6 +37,7 @@ public class ReturnResult implements Serializable { /** * 返回 code 和 data + * * @param data */ public ReturnResult(T data) { @@ -43,6 +47,7 @@ public class ReturnResult implements Serializable { /** * 返回 code 和 msg + * * @param code * @param msg */ @@ -76,19 +81,19 @@ public class ReturnResult implements Serializable { } - public ReturnResult Msg(String msg){ + public ReturnResult Msg(String msg) { this.setMsg(msg); return this; } - public ReturnResult Code(long code){ + public ReturnResult Code(long code) { this.setCode(code); return this; } - public ReturnResult Data(T data){ + public ReturnResult Data(T data) { this.setData(data); return this; } @@ -156,12 +161,14 @@ public class ReturnResult implements Serializable { /** * 异常处理 - * @param msg + * + * @param e * @param * @return */ - public static ReturnResult exceptionHandle(String msg) { - return new ReturnResult<>(ResultCode.FAILED.getCode(), msg); + public static ReturnResult exceptionHandle(Exception e) { + new BaseBean().writeLog(e); + return new ReturnResult<>(ResultCode.FAILED.getCode(), e.getMessage()); } /** diff --git a/src/com/engine/organization/util/saveimport/CompanyImportUtil.java b/src/com/engine/organization/util/saveimport/CompanyImportUtil.java new file mode 100644 index 00000000..fca164f0 --- /dev/null +++ b/src/com/engine/organization/util/saveimport/CompanyImportUtil.java @@ -0,0 +1,522 @@ +package com.engine.organization.util.saveimport; + +import com.engine.hrm.entity.RuleCodeType; +import com.engine.hrm.util.CodeRuleManager; +import com.engine.hrm.util.HrmTriggerUtil; +import com.engine.hrm.util.face.HrmFaceCheckManager; +import com.engine.organization.entity.company.po.CompPO; +import com.engine.organization.entity.department.po.DepartmentPO; +import com.engine.organization.mapper.comp.CompMapper; +import com.engine.organization.mapper.department.DepartmentMapper; +import com.engine.organization.util.db.MapperProxyFactory; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import weaver.conn.RecordSet; +import weaver.general.BaseBean; +import weaver.general.Util; +import weaver.hrm.common.AjaxManager; +import weaver.hrm.common.DbFunctionUtil; +import weaver.hrm.company.DepartmentComInfo; +import weaver.hrm.company.SubCompanyComInfo; +import weaver.matrix.MatrixUtil; +import weaver.rtx.OrganisationCom; +import weaver.systeminfo.SysMaintenanceLog; +import weaver.systeminfo.SystemEnv; + +import java.util.List; + +/** + * @author:dxfeng + * @createTime: 2022/06/30 + * @version: 1.0 + */ +public class CompanyImportUtil { + private final RecordSet recordSet = new RecordSet(); + private final OrganisationCom rtxService = new OrganisationCom(); //添加到rtx + private int id; + private String subcompanyname = ""; + private String departmentname = ""; + private String subcompanycode = ""; + private Integer subcompanyshoworder; + private String departmentcode = ""; + private Float departmentshoworder; + private int userlanguage = 7; + private int pid; + private String operateType; + private String message = ""; + + private CompMapper getCompMapper() { + return MapperProxyFactory.getProxy(CompMapper.class); + } + + private DepartmentMapper getDepartmentMapper() { + return MapperProxyFactory.getProxy(DepartmentMapper.class); + } + + public void setPid(int pid) { + this.pid = pid; + } + + public void setUserLanguage(String userlanguage) { + this.userlanguage = Util.getIntValue(userlanguage); + } + + /** + * 校验数据有效性 + */ + public String valExcelData() { + String errorInfo = ""; + if (Util.null2String(this.subcompanyname).length() == 0) { + errorInfo = SystemEnv.getHtmlLabelName(125704, userlanguage); + return errorInfo; + } + if (StringUtils.isNotEmpty(operateType) && operateType.equals("add")) { + if (!verifySubCompanyCode(subcompanycode)) return subcompanycode + "编号重复"; + if (!verifyDeptCode(departmentcode)) return departmentcode + "编号重复"; + } + return errorInfo; + } + + /** + * 保存数据 + */ + public String save() { + boolean flag = false; + try { + if (StringUtils.isNotEmpty(operateType)) { + if (operateType.equals("add")) { + int subcompanyid = 0; + int departmentid; + if (Util.null2String(this.subcompanyname).length() > 0) { + //取分部 + subcompanyid = getCompanyId(this.subcompanyname); + } + departmentid = getDeptId(this.departmentname, subcompanyid); + if (Util.null2String(this.departmentname).length() > 0) { + if (departmentid != 0) flag = true; + } else { + if (subcompanyid != 0) flag = true; + } + } else if (operateType.equals("update")) { + int subcompanyid = updateSubCompany(); + if (subcompanyid == -1) return String.valueOf(flag); + int deptid = updateDept(subcompanyid); + if (deptid == -1) return String.valueOf(flag); + flag = true; + } + } + } catch (Exception e) { + new BaseBean().writeLog(e); + } + + return String.valueOf(flag); + } + + /** + * 校验分部编号是否重复 + * + * @param code + * @return + */ + private boolean verifySubCompanyCode(String code) { + if (StringUtils.isEmpty(code)) { + return true; + } + List compPOS = getCompMapper().listByNo(code); + return CollectionUtils.isEmpty(compPOS); + } + + /** + * @param code + * @param name + * @param supsubcomid + * @return + */ + private boolean verifySubCompanyCode(String code, String name, int supsubcomid) { + if (StringUtils.isEmpty(code)) { + return true; + } + // TODO 部门重复编号验证 + RecordSet recordSet = new RecordSet(); + String sql = "select id from HrmSubCompany where subcompanyname = ? and supsubcomid = ?"; + recordSet.executeQuery(sql, name, supsubcomid); + if (recordSet.next()) { + String id = recordSet.getString("id"); + sql = "select id from HrmSubCompany where subcompanycode = ? and id != ?"; + recordSet.executeQuery(sql, code, id); + return recordSet.getCounts() <= 0; + } + return verifySubCompanyCode(code); + } + + /** + * 校验部门编号是否重复 + * + * @param code + * @return + */ + private boolean verifyDeptCode(String code) { + if (StringUtils.isEmpty(code)) { + return true; + } + List departmentPOS = getDepartmentMapper().listByNo(code); + return CollectionUtils.isEmpty(departmentPOS); + } + + private boolean verifyDeptCode(String code, String name, int subcompanyid, int supdepid) { + // TODO 部门编号校验 + if (StringUtils.isEmpty(code)) return true; + RecordSet recordSet = new RecordSet(); + String sql = "select id from HrmDepartment where departmentname = ? and subcompanyid1 = ? and supdepid = ?"; + recordSet.executeQuery(sql, name, subcompanyid, supdepid); + if (recordSet.next()) { + String id = recordSet.getString("id"); + sql = "select id from HrmDepartment where departmentcode = ? and id != ?"; + recordSet.executeQuery(sql, code, id); + return recordSet.getCounts() <= 0; + } + return verifyDeptCode(code); + } + + private int updateDept(int subcompanyid) { + String[] deptNames = departmentname.split(">"); + int currentId = 0; + int parentId = 0; + String departmentcode = ""; + Float departmentshoworder = null; + for (int i = 0; i < deptNames.length; i++) { + if (StringUtils.isEmpty(deptNames[i])) continue; + String sql = "select * from HrmDepartment where subcompanyid1=" + subcompanyid + " and departmentname='" + deptNames[i].trim() + "' and supdepid=" + parentId + " and (canceled !=1 or canceled is null)"; + currentId = getResultSetId(sql); + if (currentId == 0) { + // 部门不存在 + // 不存在 + this.setMessage("," + deptNames[i] + "部门不存在"); + return -1; + } + if (i == deptNames.length - 1) { + // 最后一层级 赋值编码和顺序 + departmentcode = this.departmentcode; + departmentshoworder = this.departmentshoworder; + } + if (StringUtils.isNotEmpty(departmentcode) || departmentshoworder != null) { + recordSet.executeQuery(sql); + recordSet.next(); + if (departmentshoworder == null) + departmentshoworder = Float.valueOf(Util.null2s(recordSet.getString("showorder"), "0")); + if (StringUtils.isEmpty(departmentcode)) + departmentcode = Util.null2String(recordSet.getString("departmentcode"), ""); + if (verifyDeptCode(departmentcode, deptNames[i], subcompanyid, parentId)) { + sql = "update hrmdepartment set departmentcode = ? , showorder = ? where departmentname = ? and subcompanyid1 = ? and supdepid = ? and (canceled !=1 or canceled is null)"; + recordSet.executeUpdate(sql, departmentcode, departmentshoworder, deptNames[i], subcompanyid, parentId); + } else { + setMessage("," + departmentcode + "编号重复"); + return -1; + } + } + parentId = currentId; + } + return currentId; + } + + private int updateSubCompany() { + String[] subcompanynames = subcompanyname.split(">"); + int parentId = 0; + int currentId = 0; + String subcompanycode = ""; + Integer subcompanyshoworder = null; + for (int i = 0; i < subcompanynames.length; i++) { + if (StringUtils.isEmpty(subcompanynames[i])) continue; + String sql = "select * from HrmSubCompany where subcompanyname='" + + subcompanynames[i].trim() + "' and supsubcomid=" + parentId; + currentId = getResultSetId(sql); + if (currentId == 0) { + // 不存在 + this.setMessage("," + subcompanynames[i] + "分部不存在"); + return -1; + } + if (i == subcompanynames.length - 1) { + // 最后一层级 赋值编码和顺序 + subcompanycode = this.subcompanycode; + subcompanyshoworder = this.subcompanyshoworder; + } + // 如果编码和顺序不存在则不更新 + if (StringUtils.isNotEmpty(subcompanycode) || subcompanyshoworder != null) { + recordSet.executeQuery(sql); + recordSet.next(); + if (subcompanyshoworder == null) + subcompanyshoworder = Integer.valueOf(Util.null2s(recordSet.getString("showorder"), "0")); + if (StringUtils.isEmpty(subcompanycode)) + subcompanycode = Util.null2String(recordSet.getString("subcompanycode"), ""); + if (verifySubCompanyCode(subcompanycode, subcompanynames[i], parentId)) { + sql = "update HrmSubCompany set subcompanycode= ? , showorder = ? where subcompanyname = ? and supsubcomid = ?"; + recordSet.executeUpdate(sql, subcompanycode, subcompanyshoworder, subcompanynames[i], parentId); + } else { + setMessage("," + subcompanycode + "编号重复"); + return -1; + } + } + parentId = currentId; + } + return currentId; + } + + /** + * 根据分部名称获取分部Id,不存在就创建 + * + * @param companyName 分部名称 eg:泛微广东>泛微深圳 + */ + public int getCompanyId(String companyName) { + String[] companyNames = companyName.split(">"); + int currentId = 0; + int parentId = 0; + String sql; + String sqlInsert; + String companyCode = ""; + Integer companyShowOrder = null; + for (int i = 0; i < companyNames.length; i++) { + if (companyNames[i] == null && companyNames[i].equals("")) { + continue; + } + sql = "select id from HrmSubCompany where subcompanyname='" + + companyNames[i].trim() + "' and supsubcomid=" + parentId; + + currentId = getResultSetId(sql); + + //added by wcd 2015-02-06 [限制分部数] + if (currentId == 0) { + if (i == companyNames.length - 1) { + // 最后一层级 赋值编码和顺序 + companyCode = this.subcompanycode; + companyShowOrder = this.subcompanyshoworder; + if (companyShowOrder == null) { + companyShowOrder = 0; + } + } + if (AjaxManager.getData("", "getLnScCount;mf").equals("true")) { + // 如果编码为空 自动生成编码 + try { + companyCode = CodeRuleManager.getCodeRuleManager().generateRuleCode(RuleCodeType.SUBCOMPANY, companyCode); + } catch (Exception e) { + setMessage("," + e.getMessage()); + new BaseBean().writeLog(e); + return -1; + } + sqlInsert = "insert into HrmSubCompany(subcompanyname,subcompanydesc,companyid,supsubcomid,subcompanycode,showorder," + DbFunctionUtil.getInsertColumnSql() + ") values('" + + companyNames[i] + "','" + companyNames[i] + "',1" + "," + parentId + ",'" + companyCode + "'," + companyShowOrder + "," + DbFunctionUtil.getInsertColumnValueSql(new RecordSet().getDBType(), 1) + ")"; // 创建 + boolean isSuccess = execSql(sqlInsert); + HrmTriggerUtil.generateSubcompanyPinyin(companyNames[i], null); + currentId = getResultSetId(sql); + HrmTriggerUtil.Tri_I_SubComKPICheckFlow(String.valueOf(currentId)); + sql = "insert into leftmenuconfig (userid,infoid,visible,viewindex,resourceid,resourcetype,locked,lockedbyid,usecustomname,customname,customname_e) select distinct userid,infoid,visible,viewindex," + currentId + ",2,locked,lockedbyid,usecustomname,customname,customname_e from leftmenuconfig where resourcetype=1 and resourceid=1"; + execSql(sql); + sql = "insert into mainmenuconfig (userid,infoid,visible,viewindex,resourceid,resourcetype,locked,lockedbyid,usecustomname,customname,customname_e) select distinct userid,infoid,visible,viewindex," + currentId + ",2,locked,lockedbyid,usecustomname,customname,customname_e from mainmenuconfig where resourcetype=1 and resourceid=1"; + execSql(sql); + + if (isSuccess) { + //同步分部数据到矩阵 + MatrixUtil.updateSubcompayData("" + currentId); + HrmFaceCheckManager.sync(currentId + "", HrmFaceCheckManager.getOptInsert(), "hrm_import_subcompany", HrmFaceCheckManager.getOaSubcompany()); + } + + insertSysLog(companyNames[i]); + } else { + currentId = -1; + } + } + parentId = currentId; + if (currentId != -1) + rtxService.addSubCompany(parentId); //同步RTX + } + return currentId; + } + + /** + * 获取部门id,不存在就创建 + * + * @param deptNames 部门名称 + * @param subCompanyId 所属分部id + */ + public int getDeptId(String deptNames, int subCompanyId) { + String[] deptName = deptNames.split(">"); + int currentId = 0; + int parentId = 0; + + String sql; + String sqlInsert; + String departmentcode = ""; + Float departmentshoworder = null; + for (int i = 0; i < deptName.length; i++) { + if (deptName[i] == null || deptName[i].equals("")) { + continue; + } + sql = "select id from HrmDepartment where subcompanyid1=" + subCompanyId + " and departmentname='" + deptName[i].trim() + "' and supdepid=" + parentId + " and (canceled !=1 or canceled is null)"; + currentId = getResultSetId(sql); + + if (currentId == 0) { + if (i == deptName.length - 1) { + departmentcode = this.departmentcode; + departmentshoworder = this.departmentshoworder; + if (departmentshoworder == null) departmentshoworder = 0.00F; + } + // 如果编码为空 自动生成编码 + try { + departmentcode = CodeRuleManager.getCodeRuleManager().generateRuleCode(RuleCodeType.DEPARTMENT, String.valueOf(subCompanyId), departmentcode); + } catch (Exception e) { + setMessage("," + e.getMessage()); + new BaseBean().writeLog(e); + return -1; + } + sqlInsert = "insert into HrmDepartment (departmentname,Departmentmark,subcompanyid1,supdepid,departmentcode,showorder," + DbFunctionUtil.getInsertColumnSql() + ") values('" + + deptName[i] + "','" + deptName[i] + "'," + subCompanyId + "," + parentId + ",'" + departmentcode + "'," + departmentshoworder + "," + DbFunctionUtil.getInsertColumnValueSql(new RecordSet().getDBType(), 1) + ")"; // 创建 + boolean isSuccess = execSql(sqlInsert); + HrmTriggerUtil.generateDepartmentPinyin(deptName[i], null); + currentId = getResultSetId(sql); + HrmTriggerUtil.Tri_I_DeptKPICheckFlow(String.valueOf(currentId)); + if (isSuccess) { + //同步部门数据到矩阵 + MatrixUtil.updateDepartmentData("" + currentId); + HrmFaceCheckManager.sync(currentId + "", HrmFaceCheckManager.getOptInsert(), "hrm_import_deptment", HrmFaceCheckManager.getOaDepartment()); + } + + insertSysLog(deptName[i]); + rtxService.addDepartment(currentId); //同步RTX + } + parentId = currentId; + } + return currentId; + } + + /** + * 获得查询结果Id + * + * @param sql 查询语句 + */ + public int getResultSetId(String sql) { + int currentId = 0; + recordSet.execute(sql); + try { + while (recordSet.next()) { + currentId = recordSet.getInt("id"); + } + } catch (Exception e) { + e.printStackTrace(); + } + return currentId; + } + + /** + * 执行插入操作 + * + * @param sql + */ + public boolean execSql(String sql) { + return recordSet.execute(sql); + } + + public void removeCache() { + try { + + weaver.matrix.MatrixUtil.sysSubcompayData(); + weaver.matrix.MatrixUtil.sysDepartmentData(); + + SubCompanyComInfo SubCompanyComInfo = new SubCompanyComInfo(); + SubCompanyComInfo.removeCompanyCache(); + + DepartmentComInfo DepartmentComInfo = new DepartmentComInfo(); + DepartmentComInfo.removeCompanyCache(); + //初始化应用分权 + new weaver.hrm.appdetach.AppDetachComInfo().initSubDepAppData(); + } catch (Exception e) { + new BaseBean().writeLog(e); + } + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getSubcompanyname() { + return subcompanyname; + } + + public void setSubcompanyname(String subcompanyname) { + this.subcompanyname = subcompanyname; + } + + public String getDepartmentname() { + return departmentname; + } + + public void setDepartmentname(String departmentname) { + this.departmentname = departmentname; + } + + public String getSubcompanycode() { + return subcompanycode; + } + + public void setSubcompanycode(String subcompanycode) { + this.subcompanycode = subcompanycode; + } + + public Integer getSubcompanyshoworder() { + return subcompanyshoworder; + } + + public void setSubcompanyshoworder(Integer subcompanyshoworder) { + this.subcompanyshoworder = subcompanyshoworder; + } + + public String getDepartmentcode() { + return departmentcode; + } + + public void setDepartmentcode(String departmentcode) { + this.departmentcode = departmentcode; + } + + public Float getDepartmentshoworder() { + return departmentshoworder; + } + + public void setDepartmentshoworder(Float departmentshoworder) { + this.departmentshoworder = departmentshoworder; + } + + public String getOperateType() { + return operateType; + } + + public void setOperateType(String operateType) { + this.operateType = operateType; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + private void insertSysLog(String name) { + SysMaintenanceLog syslog = new SysMaintenanceLog(); + syslog.resetParameter(); + syslog.setRelatedId(pid); + syslog.setOperateType("-1"); + syslog.setOperateItem("12"); + syslog.setOperateUserid(0); + syslog.setRelatedName(name); + try { + syslog.setSysLogInfo(); + } catch (Exception e) { + new BaseBean().writeLog(e); + } + } + +} diff --git a/src/com/engine/organization/util/saveimport/HrmResourceImportAdaptUtil.java b/src/com/engine/organization/util/saveimport/HrmResourceImportAdaptUtil.java new file mode 100644 index 00000000..0dc8dbea --- /dev/null +++ b/src/com/engine/organization/util/saveimport/HrmResourceImportAdaptUtil.java @@ -0,0 +1,1055 @@ +package com.engine.organization.util.saveimport; + +import com.engine.hrm.util.HrmWeakPasswordUtil; +import com.engine.organization.entity.extend.po.ExtendInfoPO; +import com.engine.organization.entity.hrmresource.param.HrmResourceImportParam; +import com.engine.organization.mapper.extend.ExtendInfoMapper; +import com.engine.organization.util.db.MapperProxyFactory; +import org.apache.poi.hssf.usermodel.HSSFDateUtil; +import org.apache.poi.ss.usermodel.*; +import weaver.common.DateUtil; +import weaver.file.FileUploadToPath; +import weaver.file.ImageFileManager; +import weaver.general.BaseBean; +import weaver.general.Util; +import weaver.hrm.settings.ChgPasswdReminder; +import weaver.hrm.settings.RemindSettings; +import weaver.systeminfo.SystemEnv; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.nio.charset.StandardCharsets; +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.regex.Pattern; + +/** + * @author:dxfeng + * @createTime: 2022/06/27 + * @version: 1.0 + */ +public class HrmResourceImportAdaptUtil { + + private String fileName; + + private String importType; + + private Sheet sheet; + + private int sheetCount = 0; + + private final List errorInfo = new ArrayList<>(); + + private String[] temFields; + + //标准模板字段 + private String tempField = "分部,部门," + + "编号,姓名,登录名,密码,安全级别,性别," + + "岗位,职务,职务类型,职称,职级," + + "职责描述,直接上级,助理,状态," + + "办公室,办公地点,办公电话,移动电话,其他电话," + + "传真,电子邮件,系统语言,出生日期,民族," + + "籍贯,户口,身份证号码," + + "婚姻状况,政治面貌,入团日期,入党日期," + + "工会会员,学历,学位,健康状况,身高," + + "体重,用工性质,合同开始日期,合同结束日期,试用期结束日期,现居住地,家庭联系方式,暂住证号码," + + "入职日期,参加工作日期," + + "公积金帐户,账号类型,主账号,身高(cm),体重(kg),工资账号户名,工资银行,工资账号," + + "办公室电话,显示顺序,人员密级"; + + //存放必填列下标数组,包含自定义字段中的必填列 + private String[] requiredFields; + + //必填列标准模板或字段下标 + private final String requiredField = "0,1,3,8,9,10,18"; + + //标准导入字段数组 + private String[] voFields; + + //标准导入字段 + private String voField = "company_id,department_id," + + "work_code,last_name,login_id,pass_word,sec_level,sex," + + "job_title,job_activity,job_group_id,job_call,job_level," + + "job_activity_desc,manager_id,assistant_id,status," + + "workroom,location_id,telephone,mobile,mobile_call," + + "fax,email,system_language,birthday,folk," + + "native_place,reg_resident_place,certificate_num," + + "marital_status,policy,be_member_date,be_party_date," + + "islabouunion,education_level,degree,health_info,height," + + "weight,use_kind,start_date,end_date,probation_end_date," + + "resident_place,home_address,temp_resident_number," + + "company_start_date,work_start_date," + + "accum_fund_account,account_type,belong_to,height,weight,account_name,bank_id,account_id," + + "telephone,show_order,classification"; + + //基本信息字段数组最后下标 + private int baseFieldsLastIndex = 0; + + //基础自定义信息字段数组最后下标 + private int baseFieldsLastIndex1 = 0; + + + // 重复性验证标准数据库字段下标 例如 + private int keyFieldIndex = 2; + + // 重复性验证excel字段下标 + private int keyColumn = -1; + + // 用于做重复性验证,重复性与行键值对,<编号,4>,<编号,5> + private final Map repeatKeyMap = new HashMap<>(); + + private int certificateNumIndex = 29; + private int certificateNumColumn = -1; + private final Map certificateNums = new HashMap<>(); + + Map> checkInfos = new HashMap<>(); + + private final String[] checkKeys = new String[]{"login_id", "work_code"}; + + private int accountTypeIndex = 50; + private int accountTypeColumn = -1; + + // 用于存贮HrmResource所有方法参数内容格式为,通过fieldsMaping中的对应关系可以找到方法和参数 + private final Map parameterTypes = new HashMap<>(); + + // HrmResourceVo povo对象属性类型,用于反射赋值 + private final Map fieldTypes = new HashMap<>(); + + //excel字段数组下标与标准字段数组下标对应关系 + private final Map fieldsMap = new HashMap<>(); + + //人员map集合 + private final LinkedHashMap hrmResourceMap = new LinkedHashMap<>(); + + Map cusFieldValMap = new HashMap<>(); //个人信心自定义字段与工作信息自定字段数据验证条件 + + private int userlanguage = 7; //登录语言 + + //弱密码禁止保存:false-允许保存弱密码、true-不允许保存弱密码 + private boolean weakPasswordDisable = false; + //判断弱密码 + private HrmWeakPasswordUtil hrmWeakPasswordUtil; + + /** + * map集合创建类 + * + * @param fu 上传参数 + * @return List + */ + public List creatImportMap(FileUploadToPath fu) { + try { + new BaseBean().writeLog("lxr2018>>>language2=" + userlanguage); + // 初始化数据 + initDataSource(fu); + + if (!errorInfo.isEmpty()) { + deleteFile(); + return errorInfo; + } + //初始化模板字段 + initTempFields(); + + // 模板验证 + valExcelTemp(); + + if (!errorInfo.isEmpty()) { + deleteFile(); + return errorInfo; + } + + // 读取数据并验证 + readExcel(); + + deleteFile(); + return errorInfo; + } catch (NegativeArraySizeException e) { + //目前尚不清楚,这种异常的产生原因 + errorInfo.add(SystemEnv.getHtmlLabelName(83615, userlanguage)); + new BaseBean().writeLog(e); + return errorInfo; + } catch (Exception e) { + //Excel导入错误,请阅读注意事项并检查模板文件 + errorInfo.add(SystemEnv.getHtmlLabelName(83617, userlanguage)); + new BaseBean().writeLog(e); + return errorInfo; + } + + } + + private void deleteFile() { + new Thread(() -> { + try { + Thread.sleep(30 * 1000); + ImageFileManager.deletePdfImageFile(Util.getIntValue(fileName)); + } catch (InterruptedException e) { + new BaseBean().writeLog(e); + } + }).start(); + } + + /** + * 获取人员map + */ + public Map getHrmImportMap() { + return hrmResourceMap; + } + + /** + * 获取上传文件,初始化参数 + * + * @param fu + */ + public void initDataSource(FileUploadToPath fu) { + this.importType = fu.getParameter("importType"); + + // 重复性验证字段 + String keyField = fu.getParameter("keyField"); + + voFields = voField.split(","); + + for (int i = 0; i < voFields.length; i++) { + if (keyField.equals(voFields[i])) { + keyFieldIndex = i; + } + // 身份证号 + if ("certificate_num".equalsIgnoreCase(voFields[i])) { + certificateNumIndex = i; + } + // 账号类型 + if ("account_type".equalsIgnoreCase(voFields[i])) { + accountTypeIndex = i; + } + if (keyFieldIndex != 2 && certificateNumIndex != 29) break; + } + try { + this.fileName = fu.getParameter("excelfile"); + ImageFileManager manager = new ImageFileManager(); + manager.getImageFileInfoById(Util.getIntValue(this.fileName)); + Workbook workbook = WorkbookFactory.create(manager.getInputStream()); + this.sheetCount = workbook.getNumberOfSheets(); + this.sheet = workbook.getSheetAt(this.sheetCount > 1 ? 1 : 0); + } catch (FileNotFoundException ignored) { + } catch (IOException e) { + errorInfo.add(SystemEnv.getHtmlLabelName(83618, userlanguage)); //上传文件不是excel文件 + new BaseBean().writeLog(e); + } catch (IndexOutOfBoundsException e) { + errorInfo.add(SystemEnv.getHtmlLabelName(83619, userlanguage)); + new BaseBean().writeLog(e); + } + + ChgPasswdReminder reminder = new ChgPasswdReminder(); + RemindSettings settings = reminder.getRemindSettings(); + //判断是否启用【弱密码禁止保存】 + this.weakPasswordDisable = Util.null2String(settings.getWeakPasswordDisable()).equals("1"); + try { + //判断是否为弱密码 + hrmWeakPasswordUtil = new HrmWeakPasswordUtil(); + } catch (Exception e) { + errorInfo.add("加载弱密码集合出错"); + new BaseBean().writeLog(e); + } + } + + /** + * 验证模板格式 + */ + public void valExcelTemp() { + int rowIndex = (this.sheetCount > 1 ? 1 : 0); + Row row; + Cell cell; + String cellValue; + List fieldList = new ArrayList<>(); + try { + row = sheet.getRow(rowIndex); + for (int i = 0; i < row.getLastCellNum(); i++) { + boolean flag = false; + cell = row.getCell((short) i); + if (cell != null) { + cellValue = getCellValue(cell).trim(); + for (int k = 0; k < temFields.length; k++) { + if (cellValue.equals(temFields[k])) { + fieldsMap.put(i, k); + fieldList.add(cellValue); + if (keyFieldIndex == k) //如果重复性验证标准数据库字段下标与标准excel模板下标相等,则找到对应的excel验证列 + keyColumn = i; + if (certificateNumIndex == k) { + certificateNumColumn = i; + } + if (accountTypeIndex == k) { + accountTypeColumn = i; + } + flag = true; + break; + } + } + if (!flag) + errorInfo.add(getCellPosition(i, (rowIndex + 1)) + "[" + cellValue + "]" + " 不是模板中字段,请检查是否有误"); //不是模板中字段,请检查是否有误 + if (importType.equals("add")) { //如果是插入操作才验证固定列 + if (i == 0 && !cellValue.equals(temFields[0])) + errorInfo.add("分部必须在第" + (rowIndex + 1) + "行第1列"); //【分部】固定列 + if (i == 1 && !cellValue.equals(temFields[1])) + errorInfo.add("部门必须在第" + (rowIndex + 1) + "行第2列"); // 【部门】固定列 + } else { + //如果是更新,并且存在分部部门列,就规定分部、部门在第1、2列 + if (cellValue.equals(temFields[0]) && !temFields[1].equals(getCellValue(rowIndex, 1).trim())) + errorInfo.add("更新时有分部则后一列必须为部门,且第" + (rowIndex + 1) + "行第1列为分部,第2列为部门"); //【分部】固定列 + else if (cellValue.equals(temFields[0]) && i != 0) + errorInfo.add("分部必须在第" + (rowIndex + 1) + "行第1列"); //【分部】固定列 + + + if (cellValue.equals(temFields[1]) && !temFields[0].equals(getCellValue(rowIndex, 0).trim())) + errorInfo.add("更新时有部门则前一列必须为分部,且第" + (rowIndex + 1) + "行第1列为分部,第2列为部门"); //【分部】固定列 + else if (cellValue.equals(temFields[1]) && i != 1) + errorInfo.add("部门必须在第" + (rowIndex + 1) + "行第2列"); //【部门】固定列 + + } + } + } + if (keyColumn == -1) + errorInfo.add("[" + temFields[keyFieldIndex] + "]" + " 您所选的重复性验证字段不在模板中"); //您所选的重复性验证字段不在模板中 + + if (importType.equals("add")) { //如果是插入操作才验证必填列 + for (String field : requiredFields) { + boolean flag = false; + for (String s : fieldList) { + if (temFields[Integer.parseInt(field)].equals(s)) { + flag = true; + break; + } + } + if (!flag) + errorInfo.add("[" + temFields[Integer.parseInt(field)] + "]" + " 为必填字段"); //必填字段 + } + } + } catch (IllegalArgumentException e) { + errorInfo.add(SystemEnv.getHtmlLabelName(83617, userlanguage)); // excel模板有误时 + new BaseBean().writeLog(e); + } + } + + /** + * 初始化反射所需要的方法和字段Map,parameterTypes,fieldTypes + */ + public void initReflectParam() { + Class hrmResourceImportParamClass = HrmResourceImportParam.class; + Method[] hrmResourceMethods = hrmResourceImportParamClass.getDeclaredMethods(); + + for (Method hrmResourceMethod : hrmResourceMethods) { + parameterTypes.put(hrmResourceMethod.getName(), + hrmResourceMethod); + } + + Field[] hrmResourceFields = hrmResourceImportParamClass.getDeclaredFields(); + + for (Field hrmResourceField : hrmResourceFields) { + Class fieldTypeClass = hrmResourceField.getType(); + fieldTypes.put(hrmResourceField.getName(), fieldTypeClass + .getName()); + } + } + + /** + * 读取excel数据 + */ + public void readExcel() { + + initReflectParam(); // 初始化反射参数 + + boolean flag; // 标记验证是否通过 + Row row; + Cell cell; + int rowNum; // 行号 + int cellNum; // 列号 + int firstRow = (this.sheetCount > 1 ? 2 : 1); + String keyValue = ""; + int lastRow = sheet.getLastRowNum(); + String subCompany = ""; + String department = ""; + String cellValue; + int fieldIndex; + HrmResourceImportParam importParam; + + for (int i = firstRow; i <= lastRow; i++) { + flag = true; + row = sheet.getRow(i); + if (row == null) { + errorInfo.add(SystemEnv.getHtmlLabelName(15323, userlanguage) + " " + (i + 1) + " " + SystemEnv.getHtmlLabelName(83622, userlanguage)); + continue; + } + rowNum = row.getRowNum(); + StringBuilder baseFieldsValue = new StringBuilder(); + StringBuilder baseFields = new StringBuilder(); + if (repeatValidate(row, rowNum)) { // 重复性验证 + continue; + } + + importParam = new HrmResourceImportParam(); + + for (int cellIndex = 0; cellIndex < fieldsMap.size(); cellIndex++) { + + cell = row.getCell((short) cellIndex); + + cellNum = cellIndex; + + + fieldIndex = fieldsMap.get(cellNum); + + cellValue = getCellValue(cell).trim(); + + if (valExcelDataFormate(rowNum, cellNum, cellValue)) { + if (fieldIndex == keyFieldIndex) { // 验证通过,如果当前单元格为重复性验证单元格,则把值赋给keyValue + keyValue = cellValue; + } + } else { + flag = false; + } + + if (flag) { // 为true则,设置值,否则不需要 + + if (fieldIndex == 0 && getCellValue(1, cellNum).equals("分部")) { // 对于excel分部为空则取上面分部读取的值 + if (cellValue.equals("")) + cellValue = subCompany; + else + subCompany = cellValue; + } + + if (fieldIndex == 1 && getCellValue(1, cellNum).equals("部门")) { // 对于excel部门为空则取上面部门读取的值 + if (cellValue.equals("")) + cellValue = department; + else + department = cellValue; + } + + if (fieldIndex <= baseFieldsLastIndex) { + setHrmResourceValue(fieldIndex, cellValue, importParam, null); + } + + if (fieldIndex > baseFieldsLastIndex && fieldIndex <= baseFieldsLastIndex1) { + baseFields.append(",").append(voFields[fieldIndex]); + if (cellValue.equals("")) + cellValue = "?"; + baseFieldsValue.append(";").append(cellValue); + setHrmResourceValue(0, baseFields.substring(1), importParam, "baseFields"); + setHrmResourceValue(0, baseFieldsValue.substring(1), importParam, "baseFieldsValue"); + } + + } + } + String currentDate = DateUtil.getCurrentDate(); + if (Util.null2String(importParam.getWork_start_date()).length() > 0 && Util.null2String(importParam.getWork_year()).length() == 0) {//计算工龄 + int day = DateUtil.dayDiff(importParam.getWork_start_date(), currentDate); + DecimalFormat df = new DecimalFormat("0.0"); + importParam.setWork_year(df.format(day / 365.0)); + } + + if (Util.null2String(importParam.getCompany_start_date()).length() > 0 && Util.null2String(importParam.getCompany_work_year()).length() == 0) {//计算司令 + int day = DateUtil.dayDiff(importParam.getWork_start_date(), currentDate); + DecimalFormat df = new DecimalFormat("0.0"); + importParam.setCompany_work_year(df.format(day / 365.0)); + } + + repeatKeyMap.put(keyValue, "" + (i + 1)); // 用于重复性验证 + if (importParam.getAccount_type() != null && !"".equals(importParam.getAccount_type())) { + if ("主账号".equals(importParam.getAccount_type())) { + certificateNums.put(importParam.getCertificate_num(), String.valueOf(i + 1)); + } + } else { + certificateNums.put(importParam.getCertificate_num(), String.valueOf(i + 1)); + } + + if (checkInfo(importParam, rowNum)) { // 重复性验证 + continue; + } + + //新增账号、工号唯一性校验 + for (String key : checkKeys) { + Map checkInfo = checkInfos.get(key); + if (checkInfo == null) { + checkInfo = new HashMap<>(); + checkInfos.put(key, checkInfo); + } else { + checkInfo = checkInfos.get(key); + } + String val = ""; + switch (key) { + case "login_id": + val = importParam.getLogin_id(); + break; + case "work_code": + val = importParam.getWork_code(); + break; + case "certificate_num": + val = importParam.getCertificate_num(); + break; + } + checkInfo.put(val, String.valueOf(i + 1)); + checkInfos.put(key, checkInfo); + } + + if (flag) { + hrmResourceMap.put(keyValue, importParam); + } + } + } + + /** + * 重复性验证,读取唯一性cell值,然后从HrmResourceMap中查找是否存在 + * + * @param row 行 + * @param rowNum 行下标 + */ + public boolean repeatValidate(Row row, int rowNum) { + if (certificateNumColumn == -1) + return false; + String certificateNum = getCellValue(row.getCell((short) certificateNumColumn)).trim(); + String accounttype = getCellValue(row.getCell((short) accountTypeColumn)).trim(); + String key = getCellValue(row.getCell((short) keyColumn)).trim(); + if (voFields[fieldsMap.get(keyColumn)].equals("")) + key = getCellValue(row.getCell((short) 0)).trim() + ">" + getCellValue(row.getCell((short) 1)).trim() + "_" + key; + String repeatRow = repeatKeyMap.get(key); + String cnRow = certificateNums.get(certificateNum); + if (repeatRow != null) { + errorInfo.add((rowNum + 1) + "," + repeatRow + " 行重复"); //重复 num_5,6 行重复 + return true; + } else if (cnRow != null && certificateNum.length() > 0) { + if ("次账号".equalsIgnoreCase(accounttype)) { + return false; + } else { + errorInfo.add((rowNum + 1) + "," + cnRow + " " + SystemEnv.getHtmlLabelName(83623, userlanguage)); + return true; + } + } else { + return false; + } + } + + private boolean checkInfo(HrmResourceImportParam importParam, int rowNum) { + //新增账号、工号唯一性校验 + for (String key : checkKeys) { + Map checkInfo = checkInfos.get(key); + if (checkInfo != null && !checkInfo.isEmpty()) { + String val = ""; + String errorMsg = ""; + switch (key) { + case "login_id": + val = Util.null2String(importParam.getLogin_id()).trim(); + errorMsg = SystemEnv.getHtmlLabelName(520127, userlanguage); + break; + case "work_code": + val = Util.null2String(importParam.getWork_code()).trim(); + errorMsg = SystemEnv.getHtmlLabelName(520128, userlanguage); + break; + case "certificate_num": + val = Util.null2String(importParam.getCertificate_num()).trim(); + errorMsg = SystemEnv.getHtmlLabelName(83623, userlanguage); + break; + } + String cnRow = Util.null2String(checkInfo.get(val)); + if (cnRow.length() > 0 && val.length() > 0) { + errorInfo.add((rowNum + 1) + "," + cnRow + errorMsg); + return true; + } + } + } + return false; + } + + /** + * 验证数据格式,必填列是否为空 + * + * @param rowNum 行号 + * @param cellNum 列号 + * @param cellValue 单元格值 + */ + public boolean valExcelDataFormate(int rowNum, int cellNum, String cellValue) { + + boolean flag = true; + String msg; + int fieldIndex = fieldsMap.get(cellNum); + String fieldName = voFields[fieldIndex]; + + // 人员信息第1行(模板第2行)的分部和部门为必填 + + if ((rowNum == 1 || rowNum == 2) && fieldName.equals("company_id") && getCellValue(1, cellNum).equals("分部") && cellValue.equals("")) { + msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; //【分部】为必填 + errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83626, userlanguage)); + return false; + } + + if ((rowNum == 1 || rowNum == 2) && fieldName.equals("department_id") && getCellValue(1, cellNum).equals("部门") && cellValue.equals("")) { + msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; //【部门】为必填 + errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83626, userlanguage)); + return false; + + } + //【分部】不为空则【部门】为必填 + if (fieldName.equals("department_id") && cellValue.equals("")) { + if (!getCellValue(rowNum, cellNum - 1).equals("")) { //分部不为空 + msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; + errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83626, userlanguage)); + return false; + } + } + + // 姓名 + if (fieldName.equals("last_name") && cellValue.equals("")) { + msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; //【姓名】为必填 + errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83626, userlanguage)); + return false; + } + + // 岗位 + if (fieldName.equals("job_title") && cellValue.equals("")) { + msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; //【岗位】为必填 + errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83626, userlanguage)); + return false; + } + + if (fieldName.equals("job_activity") && cellValue.equals("")) { + msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; //【职务】为必填 + errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83626, userlanguage)); + return false; + } + + if (fieldName.equals("job_group_id") && cellValue.equals("")) { + msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; //【职务类型】为必填 + errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83626, userlanguage)); + return false; + } + + // 办公地点 + if (fieldName.equals("location_id") && cellValue.equals("")) { + msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; //【办公地点】为必填 + errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83626, userlanguage)); + return false; + } + + //自定义字段为必填设置时 + if (fieldIndex > baseFieldsLastIndex && requiredField.contains(String.valueOf(fieldIndex))) { + if (cellValue.equals("")) { + msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; + errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83626, userlanguage)); + return false; + } + } + + //基本信息、个人信息、工作信息自定义验证 + if (fieldIndex > baseFieldsLastIndex && !cellValue.equals("")) { + //自定义信息字段不能包含‘?’问号 + if (cellValue.contains("?") && getStrLength(cellValue) == 1) { + msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; + errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83627, userlanguage)); + return false; + } + String valType = cusFieldValMap.get(fieldIndex); + if (valType != null) + if (valType.equals("isInt")) { + if (!isInteger(cellValue)) { + msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; + errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83628, userlanguage)); + return false; + } + if (getStrLength(cellValue) > 18 && (Integer.MAX_VALUE < Double.parseDouble(cellValue) || Double.parseDouble(cellValue) < Integer.MIN_VALUE)) { + msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; + errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83629, userlanguage) + Integer.MAX_VALUE + SystemEnv.getHtmlLabelName(15508, userlanguage) + Integer.MIN_VALUE); + return false; + } + + } else if (valType.equals("isDouble")) { + if (isDecimal(cellValue)) { + msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; + errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83637, userlanguage)); + return false; + } + if (getStrLength(cellValue) > 18) { + flag = false; + msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; + errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83639, userlanguage)); + } + } else if (valType.equals("isDate")) { + if (getStrLength(cellValue) != 10) { + flag = false; + msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; + errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83640, userlanguage)); + } + + } else if (isInteger(valType) && getStrLength(cellValue) > Integer.parseInt(valType)) { + msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; + errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83641, userlanguage) + valType + SystemEnv.getHtmlLabelName(20075, userlanguage)); + return false; + } else if (valType.equals("isCheck") && !cellValue.equals("0") && !cellValue.equals("1")) { + msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; + errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83644, userlanguage)); + return false; + } + } + + //安全级别、职级整数格式验证、大于0验证 + if ((fieldName.equals("sec_level") || fieldName.equals("job_level")) && !cellValue.equals("")) { + if (fieldName.equals("sec_level")) { + //安全级别不能大于999 + if (Util.getIntValue(cellValue) > 999) { + msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; + errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(515522, userlanguage)); + return false; + } + //安全级别不能小于-999 + if (Util.getIntValue(cellValue) < -999) { + msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; + errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(515523, userlanguage)); + return false; + } + } else { + if (!isInteger(cellValue)) { + msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; + errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83645, userlanguage)); + return false; + } + if (Integer.parseInt(cellValue) < 0 || Integer.parseInt(cellValue) > 1000) { + msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; + errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83648, userlanguage)); + return false; + } + } + } + //身高、体重数据格式验证、大于0验证 + if ((fieldName.equals("height") || fieldName.equals("weight")) && !cellValue.equals("")) { + if (isDecimal(cellValue)) { + msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; + errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83650, userlanguage)); + return false; + } + if (Double.parseDouble(cellValue) < 0 || Double.parseDouble(cellValue) > 1000) { + msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; + errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83648, userlanguage)); + return false; + } + } + + + //长度为200个字符的标准字段 + if ((fieldName.equals("job_title") || fieldName.equals("job_activity") || fieldName.equals("job_group_id") || + fieldName.equals("location_id") || fieldName.equals("job_activity_desc") || fieldName.equals("reg_resident_place")) && !cellValue.equals("") && getStrLength(cellValue) > 200) { + msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; + errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83666, userlanguage) + "200" + SystemEnv.getHtmlLabelName(20075, userlanguage)); + return false; + } + + //长度为100的标准字段 + if ((fieldName.equals("login_id") || fieldName.equals("pass_word") || fieldName.equals("home_address") || fieldName.equals("native_place")) && !cellValue.equals("") && getStrLength(cellValue) > 100) { + + msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; //自定义日期字段长度验证 + errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83666, userlanguage) + "100" + SystemEnv.getHtmlLabelName(20075, userlanguage)); + return false; + + } + //长度为60的标准字段 + if ((fieldName.equals("last_name") || fieldName.equals("pass_word") || fieldName.equals("telephone") || fieldName.equals("mobile") || fieldName.equals("mobile_call") + || fieldName.equals("email") || fieldName.equals("workroom") || fieldName.equals("work_code") || fieldName.equals("fax") + || fieldName.equals("certificate_num") || fieldName.equals("job_call") || fieldName.equals("temp_resident_number")) + && !cellValue.equals("") && getStrLength(cellValue) > 60) { + + msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; + errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83666, userlanguage) + "60" + SystemEnv.getHtmlLabelName(20075, userlanguage)); + return false; + + } + + //长度为30个字符的标准字段 + if ((fieldName.equals("degree") || fieldName.equals("policy")) && !cellValue.equals("") && getStrLength(cellValue) > 30) { + msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; + errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83666, userlanguage) + "30" + SystemEnv.getHtmlLabelName(20075, userlanguage)); + return false; + } + + //长度为10个字符的标准字段 + if ((fieldName.equals("birthday") || fieldName.equals("be_member_date") || fieldName.equals("be_party_date") || + fieldName.equals("start_date") || fieldName.equals("end_date") || fieldName.equals("probation_end_date")) && !cellValue.equals("") && getStrLength(cellValue) > 10) { + msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; + errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83666, userlanguage) + "10" + SystemEnv.getHtmlLabelName(20075, userlanguage)); + return false; + } + + //分部各级长度验证 + if (fieldName.equals("company_id") && !cellValue.equals("")) { + String[] subcompanyname = cellValue.split(">"); + for (String s : subcompanyname) { + if (getStrLength(s) > 200) + flag = false; + } + if (!flag) { + msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; + errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83667, userlanguage)); + return false; + } + } + + //部门各级长度验证 + if (fieldName.equals("department_id") && !cellValue.equals("")) { + String[] departmentname = cellValue.split(">"); + for (String s : departmentname) { + if (getStrLength(s) > 200) + flag = false; + } + if (!flag) { + msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; + errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83668, userlanguage)); + return false; + } + } + + //当启用【弱密码禁止保存】时,弱密码导入失败,失败信息为“密码安全性过弱” + if ("pass_word".equalsIgnoreCase(fieldName)) { + if (weakPasswordDisable && hrmWeakPasswordUtil.isWeakPsd(cellValue)) { + msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; + errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(515436, userlanguage)); + return flag; + } + } + + if (fieldIndex == keyFieldIndex && cellValue.equals("")) { + msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; // 重复性验证字段不在模板中 + errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83626, userlanguage)); + return false; + } + + return flag; + } + + /** + * 通过反射为对象赋值 + * + * @param cellNum 列号 + * @param cellValue 单元格值 + * @param importParam 需要赋值的HrmResource + */ + public void setHrmResourceValue(int cellNum, String cellValue, + HrmResourceImportParam importParam, String field) { + if (field == null) { + String excelField = voFields[cellNum]; + String methodName = "set" + excelField.substring(0, 1).toUpperCase() + + excelField.substring(1); + Method method = parameterTypes.get(methodName); + try { + String fieldType = fieldTypes.get(excelField); + if (fieldType.equals("java.lang.String")) + method.invoke(importParam, cellValue); + else if (fieldType.equals("java.lang.Integer")) { + if (!cellValue.equals("")) { + method.invoke(importParam, Integer.parseInt(cellValue)); + } + } else if (fieldType.equals("java.lang.Float") && !cellValue.equals("")) + method.invoke(importParam, Float.parseFloat(cellValue)); + else if (fieldType.equals("java.lang.Short") && !cellValue.equals("")) { + method.invoke(importParam, Short.parseShort(cellValue)); + } + } catch (Exception e) { + new BaseBean().writeLog(e); + } + } else { + String methodName = "set" + field.substring(0, 1).toUpperCase() + + field.substring(1); + Method method = parameterTypes.get(methodName); + try { + method.invoke(importParam, cellValue); + } catch (Exception e) { + new BaseBean().writeLog(e); + } + } + } + + /** + * excel单元格位置转换 + * + * @param cellIndex 列号 + * @param rowNum 行号 + */ + public String getCellPosition(int cellIndex, int rowNum) { + + int count = cellIndex / 26; + String cellChar = String.valueOf((char) (cellIndex % 26 + 65)); + String cellPosition; + + if (count != 0) + cellPosition = (char) ((count - 1) + 65) + cellChar; + else + cellPosition = cellChar; + cellPosition += rowNum; + return cellPosition; + } + + /** + * 初始化模板字段 + */ + public void initTempFields() { + new BaseBean().writeLog("initTempFields"); + + temFields = tempField.split(","); + + baseFieldsLastIndex = temFields.length - 1; + + int requiredFieldIndex = baseFieldsLastIndex; + + /*基本信息信息字段*/ + StringBuilder baseField = new StringBuilder(); + StringBuilder baseFieldLabel = new StringBuilder(); + String fieldHtmlType; + List infoPOList = MapperProxyFactory.getProxy(ExtendInfoMapper.class).listFields("4", "", "JCL_ORG_HRMRESOURCE", ""); + for (ExtendInfoPO extendInfoPO : infoPOList) { + fieldHtmlType = extendInfoPO.getControlType().toString(); + if (fieldHtmlType.equals("1") || fieldHtmlType.equals("2") || fieldHtmlType.equals("3") + || fieldHtmlType.equals("4") || fieldHtmlType.equals("5")) { + baseField.append(",field").append(extendInfoPO.getId()); + baseFieldLabel.append(",").append(extendInfoPO.getFieldNameDesc()); + requiredFieldIndex++; + //验证条件 + //1为html文本类型 + switch (fieldHtmlType) { + case "1": + switch (extendInfoPO.getBrowserType()) { + case "1"://1为文本数据类型 + String fielddbtype = extendInfoPO.getFieldType(); + fielddbtype = fielddbtype.substring(fielddbtype.indexOf("(") + 1, fielddbtype.lastIndexOf(")")); //截取字符设置的长度 + cusFieldValMap.put(requiredFieldIndex, fielddbtype); + break; + case "2":// 2为整数数据类型 + cusFieldValMap.put(requiredFieldIndex, "isInt"); + break; + case "3":// 3为浮点数数据类型 + cusFieldValMap.put(requiredFieldIndex, "isDouble"); + break; + default: + cusFieldValMap.put(requiredFieldIndex, ""); + break; + } + break; + case "4"://4 为check框 + cusFieldValMap.put(requiredFieldIndex, "isCheck"); + break; + case "3": + if (extendInfoPO.getBrowserType().equals("2")) { + cusFieldValMap.put(requiredFieldIndex, "isDate"); + } else if (extendInfoPO.getBrowserType().equals("19")) { + cusFieldValMap.put(requiredFieldIndex, "isTime"); + } else { + cusFieldValMap.put(requiredFieldIndex, "isBrowser"); + } + break; + case "5": + cusFieldValMap.put(requiredFieldIndex, "isSelect"); + break; + } + } + } + voField = voField + baseField; + tempField = tempField + baseFieldLabel; + temFields = tempField.split(","); + baseFieldsLastIndex1 = temFields.length - 1; + requiredFields = requiredField.split(","); + } + + /** + * 获取excel单元格值 + * + * @param cell 要读取的单元格对象 + */ + public String getCellValue(Cell cell) { + String cellValue = ""; + if (cell == null) + return ""; + switch (cell.getCellType()) { + case BOOLEAN: //得到Boolean对象的方法 + cellValue = String.valueOf(cell.getBooleanCellValue()); + break; + case NUMERIC: + cellValue = SaveImportProcessUtil.getString(HSSFDateUtil.isCellDateFormatted(cell), cell.getDateCellValue(), cell.getNumericCellValue()); + break; + case FORMULA: //读取公式 + cellValue = cell.getCellFormula(); + break; + case STRING: //读取String + cellValue = cell.getStringCellValue(); + if (cellValue == null) + cellValue = ""; + Date d = validDate(cellValue); + if (d != null) + cellValue = new SimpleDateFormat("yyyy-MM-dd").format(d); + break; + } + cellValue = Util.toHtmlForHrm(cellValue); + return cellValue; + } + + private Date validDate(String str) { + Date d = null; + SimpleDateFormat fmt1 = new SimpleDateFormat("yyyy-MM-dd"); + fmt1.setLenient(false); + SimpleDateFormat fmt2 = new SimpleDateFormat("yyyy/MM/dd"); + fmt2.setLenient(false); + try { + d = fmt1.parse(str); + } catch (Exception ignored) { + } + try { + d = fmt2.parse(str); + } catch (Exception ignored) { + + } + return d; + } + + /** + * 获取指定行、列的单元格值 + * + * @param cellNum + * @return + */ + public String getCellValue(int rowNum, int cellNum) { + Row row = sheet.getRow(rowNum); + Cell cell = row.getCell((short) cellNum); + String cellValue = getCellValue(cell); + cellValue = Util.toHtmlForHrm(cellValue); + return cellValue; + } + + //浮点数判断 + public boolean isDecimal(String str) { + if (str == null || "".equals(str)) + return true; + Pattern pattern = Pattern.compile("\\d*(\\.?)\\d*"); + return !pattern.matcher(str).matches(); + } + + //整数判断 + public boolean isInteger(String str) { + if (str == null) + return false; + Pattern pattern = Pattern.compile("\\d+"); + return pattern.matcher(str).matches(); + } + + /** + * 获取字符串字节长度 由于java中中英字符都按1个字符,而数据库中汉字按两个字符计算 + * + * @param str + * @return + */ + public int getStrLength(String str) { + try { + if (str == null) + return 0; + else + return new String(str.getBytes("gb2312"), StandardCharsets.ISO_8859_1).length(); + } catch (Exception e) { + new BaseBean().writeLog(e); + return 0; + } + } + + public void setUserlanguage(int userlanguage) { + this.userlanguage = userlanguage; + } +} diff --git a/src/com/engine/organization/util/saveimport/HrmResourceImportProcessUtil.java b/src/com/engine/organization/util/saveimport/HrmResourceImportProcessUtil.java new file mode 100644 index 00000000..dfa0e849 --- /dev/null +++ b/src/com/engine/organization/util/saveimport/HrmResourceImportProcessUtil.java @@ -0,0 +1,1743 @@ +package com.engine.organization.util.saveimport; + +import com.alibaba.fastjson.JSONObject; +import com.engine.common.util.ParamUtil; +import com.engine.common.util.ServiceUtil; +import com.engine.hrm.entity.RuleCodeType; +import com.engine.hrm.service.ImportLogService; +import com.engine.hrm.service.impl.ImportLogServiceImpl; +import com.engine.hrm.util.CodeRuleManager; +import com.engine.hrm.util.HrmWeakPasswordUtil; +import com.engine.hrm.util.face.HrmFaceCheckManager; +import com.engine.hrm.util.face.ValidateFieldManager; +import com.engine.hrm.util.face.bean.CheckItemBean; +import com.engine.organization.entity.company.po.CompPO; +import com.engine.organization.entity.department.po.DepartmentPO; +import com.engine.organization.entity.extend.param.ExtendInfoParams; +import com.engine.organization.entity.hrmresource.param.HrmResourceImportParam; +import com.engine.organization.entity.hrmresource.po.HrmResourcePO; +import com.engine.organization.entity.job.po.JobPO; +import com.engine.organization.entity.postion.po.PostInfoPO; +import com.engine.organization.entity.postion.po.PostPO; +import com.engine.organization.mapper.comp.CompMapper; +import com.engine.organization.mapper.department.DepartmentMapper; +import com.engine.organization.mapper.extend.ExtMapper; +import com.engine.organization.mapper.hrmresource.HrmResourceMapper; +import com.engine.organization.mapper.hrmresource.SystemDataMapper; +import com.engine.organization.mapper.job.JobMapper; +import com.engine.organization.mapper.post.PostInfoMapper; +import com.engine.organization.mapper.post.PostMapper; +import com.engine.organization.util.PageInfoSortUtil; +import com.engine.organization.util.db.MapperProxyFactory; +import ln.LN; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import weaver.common.DateUtil; +import weaver.common.StringUtil; +import weaver.conn.RecordSet; +import weaver.general.BaseBean; +import weaver.general.PasswordUtil; +import weaver.general.Util; +import weaver.hrm.User; +import weaver.hrm.definedfield.HrmFieldManager; +import weaver.hrm.passwordprotection.manager.HrmResourceManager; +import weaver.hrm.settings.ChgPasswdReminder; +import weaver.hrm.settings.RemindSettings; +import weaver.join.hrm.in.ImportLog; +import weaver.join.hrm.in.processImpl.HrmTlevelManager; +import weaver.systeminfo.SystemEnv; + +import javax.servlet.http.HttpServletRequest; +import java.lang.reflect.Field; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * @author:dxfeng + * @createTime: 2022/06/30 + * @version: 1.0 + */ +public class HrmResourceImportProcessUtil { + + + private final Map keyMap = new HashMap<>(); //看数据库是否有重复,将数据库现有的数据查出 + + private final Map certificateNums = new HashMap<>();//已存在的身份证 + + Map> checkInfos = new HashMap<>(); + + private final String[] checkKeys = new String[]{"login_id", "work_code"}; + + private final String date = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); + + private final int userlanguage = 7; //登录语言 + + LN license = new LN(); //license + + String keyField = ""; + String operateType = ""; + + private int scCount = 0; + + private HrmResourceImportParam hrmResourceImportParam = null; + + private String multilanguage; + + private Map sysLanguage = null; + + private Map jobcallMap = null; + private Map locationMap = null; + private Map usekindMap = null; + private Map educationlevelMap = null; + + private int cnLanguageId = 7; + + private User user; + private int pId = 0; + private int rowNum = 0; + + //判断弱密码 + private HrmWeakPasswordUtil hrmWeakPasswordUtil; + + + private HrmResourceMapper getResourceMapper() { + return MapperProxyFactory.getProxy(HrmResourceMapper.class); + } + + private CompMapper getCompMapper() { + return MapperProxyFactory.getProxy(CompMapper.class); + } + + private DepartmentMapper getDepartmentMapper() { + return MapperProxyFactory.getProxy(DepartmentMapper.class); + } + + private JobMapper getJobMapper() { + return MapperProxyFactory.getProxy(JobMapper.class); + } + + private PostInfoMapper getPostInfoMapper() { + return MapperProxyFactory.getProxy(PostInfoMapper.class); + } + + private PostMapper getPostMapper() { + return MapperProxyFactory.getProxy(PostMapper.class); + + } + + private SystemDataMapper getSystemDataMapper() { + return MapperProxyFactory.getProxy(SystemDataMapper.class); + } + + private ExtMapper getExtMapper() { + return MapperProxyFactory.getProxy(ExtMapper.class); + } + + public void setUser(User user) { + this.user = user; + } + + public void init(HttpServletRequest request) { + Map retmap; + try { + this.user = (User) request.getSession(true).getAttribute("weaver_user@bean"); + this.keyField = Util.null2String(request.getParameter("keyField")); + switch (keyField) { + case "workcode": + keyField = "work_code"; + break; + case "lastname": + keyField = "last_name"; + break; + case "loginid": + keyField = "login_id"; + break; + default: + break; + + } + this.operateType = Util.null2String(request.getParameter("operateType")); + + ImportLogService importLogService = ServiceUtil.getService(ImportLogServiceImpl.class, user); + Map params = ParamUtil.request2Map(request); + params.put("operateType", this.operateType); + retmap = importLogService.saveImportLog(params, request, user); + if (Util.null2String(retmap.get("status")).equals("1")) { + this.pId = Util.getIntValue(Util.null2String(retmap.get("pId"))); + request.getSession(true).setAttribute("hrmresourcePId", this.pId); + } + + final int F_Y = 0; + final int F_N = 1; + LN license = new LN(); + license.InLicense(); + int type = StringUtil.parseToInt(license.getScType(), F_N); + scCount = StringUtil.parseToInt(license.getScCount(), 0); + scCount = type == F_Y ? (Math.max(scCount, 0)) : 0; + + JSONObject sysLanguageByLicense = getSystemDataMapper().getSysLanguageByLicense(); + if (null != sysLanguageByLicense) { + multilanguage = sysLanguageByLicense.getString("multilanguage"); + cnLanguageId = sysLanguageByLicense.getInteger("cnLanguageId"); + } + + + sysLanguage = new HashMap<>(); + List sysLanguageByActivables = getSystemDataMapper().getSysLanguageByActivable(); + for (JSONObject sysLanguageByActivable : sysLanguageByActivables) { + sysLanguage.put(sysLanguageByActivable.getString("language"), sysLanguageByActivable.getInteger("id")); + } + educationlevelMap = new HashMap<>(); + List hrmEducationLevelDatas = getSystemDataMapper().getHrmEducationLevelData(); + for (JSONObject hrmEducationLevelData : hrmEducationLevelDatas) { + educationlevelMap.put(hrmEducationLevelData.getString("name"), hrmEducationLevelData.getInteger("id")); + } + + jobcallMap = new HashMap<>(); + List hrmJobCallDatas = getSystemDataMapper().getHrmJobCallData(); + for (JSONObject hrmJobCallData : hrmJobCallDatas) { + jobcallMap.put(hrmJobCallData.getString("name"), hrmJobCallData.getInteger("id")); + } + + locationMap = new HashMap<>(); + List hrmLocations = getSystemDataMapper().getHrmLocationsByCountryId(); + for (JSONObject hrmLocation : hrmLocations) { + locationMap.put(hrmLocation.getString("locationname"), hrmLocation.getInteger("id")); + } + + usekindMap = new HashMap<>(); + List hrmUseKindDatas = getSystemDataMapper().getHrmUseKindData(); + for (JSONObject hrmUseKindData : hrmUseKindDatas) { + usekindMap.put(hrmUseKindData.getString("name"), hrmUseKindData.getInteger("id")); + } + } catch (Exception e) { + new BaseBean().writeLog(e); + } + } + + /** + * 对人员数据进行解析,并添加到数据库 + * + * @param hrMap 人员数据Map集合 + */ + public void processMap(Map hrMap) {//增加同步锁,防止同时多次调用 + List resultList = new ArrayList<>(); //导入结果 + RecordSet recordSet = new RecordSet(); + ImportLogService importLogService = ServiceUtil.getService(ImportLogServiceImpl.class, user); + try { + String subCompanyName = ""; //分部名称 + String departmentName = ""; //部门名称 + long companyId = 0L; // 分部Id + long departmentId = 0L; // 部门id + String key; // workcode_lastname 组合 + getKeyMap(keyField); //获取重复性验证字段Map + Long id; + + Set keySet = hrMap.keySet(); + Object[] keyArray = keySet.toArray(); + + Class resourcePOClass = HrmResourcePO.class; + Class importParamClass = HrmResourceImportParam.class; + + String field = "work_code,login_id,last_name,sex,account_type,belong_to,company_id,department_id,job_activity,job_title,job_call,job_level,job_group_id,job_activity_desc,status,system_language,resource_image_id,messager_url,location_id,manager_id,assistant_id,mobile,telephone,mobile_call,fax,email,workroom,pass_word,sec_level,birthday,folk,native_place,reg_resident_place,certificate_num,marital_status,policy,be_member_date,be_party_date,islabouunion,degree,health_info,education_level,height,weight,use_kind,start_date,end_date,probation_end_date,resident_place,home_address,temp_resident_number,company_start_date,work_start_date,accum_fund_account,account_name,bank_id,account_id,show_order,classification,company_work_year,work_year"; + + String[] fields = field.split(","); + + int createrid = 1; // 创建者id + // 最后修改者id + if (user != null) { + createrid = user.getUID(); + } + + ChgPasswdReminder reminder = new ChgPasswdReminder(); + RemindSettings settings = reminder.getRemindSettings(); + //判断是否启用【启用初始密码】 + //是否启用初始密码:false-不启用初始密码、true-启用初始密码 + boolean defaultPasswordEnable = Util.null2String(settings.getDefaultPasswordEnable()).equals("1"); + //初始密码 + //初始密码 + String defaultPassword = Util.null2String(settings.getDefaultPassword()); + //判断是否启用【弱密码禁止保存】 + //弱密码禁止保存:false-允许保存弱密码、true-不允许保存弱密码 + boolean weakPasswordDisable = Util.null2String(settings.getWeakPasswordDisable()).equals("1"); + try { + //判断是否为弱密码 + hrmWeakPasswordUtil = new HrmWeakPasswordUtil(); + } catch (Exception e) { + new BaseBean().writeLog(e); + } + + String obj; + HrmResourcePO hrmResourcePO; + for (Object o : keyArray) { + obj = o.toString(); + hrmResourceImportParam = hrMap.get(obj); + key = obj; + hrmResourcePO = new HrmResourcePO(); + this.rowNum++; + try { // 异常处理 + + if (operateType.equals("add")) { + if (keyMap.get(key) != null) { + resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(83520, userlanguage))); + continue; + } + + if (this.checkInfo(hrmResourceImportParam, resultList)) { + continue; + } + if (hrmResourceImportParam.getAccount_type() == null || "".equalsIgnoreCase(Util.null2String(hrmResourceImportParam.getAccount_type()))) { + if (StringUtil.isNotNull(hrmResourceImportParam.getCertificate_num()) && certificateNums.get(StringUtil.vString(hrmResourceImportParam.getCertificate_num())) != null) { + resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(83521, userlanguage))); + continue; + } + } else { + if (hrmResourceImportParam.getAccount_type() != null && !"".equals(hrmResourceImportParam.getAccount_type())) { + if ("主账号".equals(hrmResourceImportParam.getAccount_type())) { + if (StringUtil.isNotNull(hrmResourceImportParam.getCertificate_num()) && certificateNums.get(StringUtil.vString(hrmResourceImportParam.getCertificate_num())) != null) { + resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(83521, userlanguage))); + continue; + } + } + } + } + + //添加人员信息 license 人员上限判断 + + if (keyMap.get(key) == null && StringUtils.isNotBlank(hrmResourceImportParam.getLogin_id()) && ("主账号".equals(hrmResourceImportParam.getAccount_type()) || StringUtils.isBlank(hrmResourceImportParam.getAccount_type())) && "正式,试用,临时,试用延期".contains(Util.null2String(hrmResourceImportParam.getStatus()))) { + license.reloadLicenseInfo(); + if (license.CkHrmnum() >= 0) { + resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(83522, userlanguage))); + continue; + } + } + // 分部Id + String subCompanyNames = hrmResourceImportParam.getCompany_id() + ""; + String tempSubCompanyName = ""; + if (subCompanyNames != null) { + if (!subCompanyNames.equals(subCompanyName)) { + tempSubCompanyName = subCompanyName; + subCompanyName = subCompanyNames; + companyId = getSubCompanyId(subCompanyName); + } + if (companyId == -9) { + resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getErrorMsgName(56, userlanguage))); + continue; + } + if (companyId == -2) { + resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(126274, userlanguage))); + continue; + } + if (companyId == -1) { + resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(83524, userlanguage))); + continue; + } + if (StringUtil.parseToInt(license.getConcurrentFlag(), 0) != 1) { + if (new HrmResourceManager().noMore(String.valueOf(companyId))) { + resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(83525, userlanguage))); + continue; + } + } + companyId = 0 == companyId ? null : companyId; + hrmResourcePO.setCompanyId(companyId); + } else { + resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(83526, userlanguage))); + continue; + } + + // 部门id + String departmentNames = hrmResourceImportParam.getDepartment_id(); + if (departmentNames != null) { + if (!subCompanyNames.equals(tempSubCompanyName) || !departmentNames.equals(departmentName)) { + departmentName = departmentNames; + departmentId = getDeptId(departmentName, companyId); + } + if (departmentId == -2) { + resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(126275, userlanguage))); + continue; + } + hrmResourcePO.setDepartmentId(departmentId); + } else { + resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(83527, userlanguage))); + continue; + } + + if (hrmResourceImportParam.getLast_name() == null) { + resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(83529, userlanguage))); + continue; + } + + //主账号id-sunjsh + if (hrmResourceImportParam.getAccount_type() != null && !"".equals(hrmResourceImportParam.getAccount_type())) { + if ("主账号".equals(hrmResourceImportParam.getAccount_type())) { + hrmResourcePO.setBelongTo(-1L); + hrmResourcePO.setAccountType(0); + } else if ("次账号".equals(hrmResourceImportParam.getAccount_type())) { + if (hrmResourceImportParam.getBelong_to() != null && !"".equals(hrmResourceImportParam.getBelong_to().trim())) { + long belongTo = getBelongId(hrmResourceImportParam.getBelong_to(), keyField); + hrmResourcePO.setBelongTo(belongTo); + if (!hrmResourceImportParam.getBelong_to().equals("") && belongTo == 0) { + resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(131279, userlanguage))); + continue; + } else { + hrmResourcePO.setAccountType(1); + } + } else { + resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(131279, userlanguage))); + continue; + } + } else { + hrmResourcePO.setBelongTo(-1L); + hrmResourcePO.setAccountType(0); + } + } else if (hrmResourceImportParam.getBelong_to() != null && !"".equals(hrmResourceImportParam.getBelong_to().trim())) { + long belongTo = getBelongId(hrmResourceImportParam.getBelong_to(), keyField); + hrmResourcePO.setBelongTo(belongTo); + if (!hrmResourceImportParam.getBelong_to().equals("") && belongTo == 0) { + resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(131279, userlanguage))); + continue; + } else { + hrmResourcePO.setAccountType(1); + } + } else { + hrmResourcePO.setBelongTo(-1L); + hrmResourcePO.setAccountType(0); + } + + // 岗位id + if (hrmResourceImportParam.getJob_title() != null && hrmResourceImportParam.getJob_activity() != null && hrmResourceImportParam.getJob_group_id() != null) { + String jobNames = hrmResourceImportParam.getJob_title(); + hrmResourcePO.setJobTitle(getJobTitles(companyId, departmentId, jobNames)); + } else { + resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(83531, userlanguage))); + continue; + } + + //上级id + if (hrmResourceImportParam.getManager_id() != null) { + int managerid = getManagerId(hrmResourceImportParam.getManager_id(), keyField); + hrmResourcePO.setManagerId(0 == managerid ? null : managerid); + //如果vo.getManagerid()有值,但manageid未找到,说明填写有误 + if (!hrmResourceImportParam.getManager_id().equals("") && managerid == 0) { + resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(83532, userlanguage))); + continue; + } + } else { + hrmResourcePO.setManagerId(null); + } + + // 助理id + if (hrmResourceImportParam.getAssistant_id() != null) { + int assistantId = getAssistantId(hrmResourceImportParam.getAssistant_id(), keyField); + hrmResourcePO.setAssistantId(assistantId); + if (!hrmResourceImportParam.getAssistant_id().equals("") && assistantId == 0) { + resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(24678, userlanguage))); + continue; + } + } + + // 办公地点 + if (hrmResourceImportParam.getLocation_id() != null) { + hrmResourcePO.setLocationId(getLocationId(hrmResourceImportParam.getLocation_id())); + } else { + resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(83533, userlanguage))); + continue; + } + + //邮箱-sunjsh + if (hrmResourceImportParam.getEmail() != null) { + if (!"".equals(hrmResourceImportParam.getEmail().trim()) && hrmResourceImportParam.getEmail().contains("*")) { + hrmResourceImportParam.setEmail(null); + } else if ("".equals(hrmResourceImportParam.getEmail().trim())) { + hrmResourcePO.setEmail(""); + } else { + Pattern pattern = Pattern.compile("^([a-zA-Z\\d_\\-.]+)@((\\[\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.)|(([a-zA-Z\\d\\-]+\\.)+))([a-zA-Z]{2,4}|\\d{1,3})(]?)$"); + Matcher matcher = pattern.matcher(hrmResourceImportParam.getEmail()); + if (!matcher.matches()) { + resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(24570, userlanguage))); + continue; + } else { + hrmResourcePO.setEmail(hrmResourceImportParam.getEmail()); + } + } + } + + //mobile-sunjsh + if (hrmResourceImportParam.getMobile() != null) { + if ("".equals(hrmResourceImportParam.getMobile().trim()) || (!"".equals(hrmResourceImportParam.getMobile().trim()) && hrmResourceImportParam.getMobile().contains("*"))) + hrmResourceImportParam.setMobile(null); + } else hrmResourcePO.setMobile(""); + + //工资银行-sunjsh + if (hrmResourceImportParam.getBank_id() != null && !"".equals(hrmResourceImportParam.getBank_id())) { + org.json.JSONObject jsonObject = new org.json.JSONObject(); + jsonObject.put("fieldid", 0); + jsonObject.put("fieldhtmltype", 3); + jsonObject.put("type", 284); + jsonObject.put("dmlurl", ""); + jsonObject.put("fieldvalue", hrmResourceImportParam.getBank_id()); + + String fieldvalue = HrmFieldManager.getReallyFieldvalue(jsonObject); + if (!"".equals(fieldvalue)) { + hrmResourcePO.setBankId(new Integer(fieldvalue)); + } else { + hrmResourcePO.setBankId(this.getBankId(hrmResourceImportParam.getBank_id())); + } + } + + //sunjsh-入职日期 + if (hrmResourceImportParam.getCompany_start_date() != null && !"".equals(hrmResourceImportParam.getCompany_start_date())) { + hrmResourcePO.setCompanyStartDate(hrmResourceImportParam.getCompany_start_date()); + } + + //sunjsh-参加工作日期 + if (hrmResourceImportParam.getWork_start_date() != null && !"".equals(hrmResourceImportParam.getWork_start_date())) { + hrmResourcePO.setWorkStartDate(hrmResourceImportParam.getWork_start_date()); + } + // 性别,为空或其他情况统一为0(男) + String sex = "女".equals(hrmResourceImportParam.getSex()) ? "1" : "0"; + hrmResourcePO.setSex(sex); + + // 职称 + if (hrmResourceImportParam.getJob_call() != null) { + int jobcall = getJobCall(hrmResourceImportParam.getJob_call()); + hrmResourcePO.setJobCall(jobcall); + } + // 系统语言,默认简体中文 + if (hrmResourceImportParam.getSystem_language() != null) { + int systemlanguage = getSystemLanguage(hrmResourceImportParam.getSystem_language()); + + if (systemlanguage == -1) { //只能选择简体中文|Englisth|繁体中文 + resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(518929, userlanguage))); + continue; + } + if (systemlanguage == 0) { //系统不支持多语言 + resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(84810, userlanguage))); + continue; + } + hrmResourcePO.setSystemLanguage(systemlanguage); + } else { + hrmResourcePO.setSystemLanguage(7); + } + + // 婚姻状况,如果不是以下选项,则默认为未婚 + String maritalStatus = "已婚".equals(hrmResourceImportParam.getMarital_status()) ? "1" : "离异".equals(hrmResourceImportParam.getMarital_status()) ? "2" : "0"; + hrmResourcePO.setMaritalStatus(maritalStatus); + + // 员工状态 + if (!"".equals(Util.null2String(hrmResourceImportParam.getStatus()))) { + int status = getStatus(hrmResourceImportParam.getStatus()); + hrmResourcePO.setStatus(status); + } else { + hrmResourcePO.setStatus(1); + } + + // 人员密级 + if (!"".equals(Util.null2String(hrmResourceImportParam.getClassification()))) { + int classification = getClassification(hrmResourceImportParam.getClassification()); + hrmResourcePO.setClassification(classification); + } + // 学历 + if (hrmResourceImportParam.getEducation_level() != null) { + int educationLevel = getEducationLevel(hrmResourceImportParam.getEducation_level()); + hrmResourcePO.setEducationLevel(educationLevel); + } + + // 工会会员,默认为是 + String islabouunion = "是".equals(hrmResourceImportParam.getIslabouunion()) ? "1" : "0"; + hrmResourcePO.setIslabouunion(islabouunion); + + // 健康状况 + if (hrmResourceImportParam.getHealth_info() != null) { + String healthinfo = getHealthInfo(hrmResourceImportParam.getHealth_info()); + hrmResourcePO.setHealthInfo(healthinfo); + } else { + hrmResourcePO.setHealthInfo("0"); + } + + //安全级别不能大于999 + if (Util.getIntValue(hrmResourceImportParam.getSec_level(), 0) > 999) { + resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(515522, userlanguage))); + continue; + } + //安全级别不能小于-999 + if (Util.getIntValue(hrmResourceImportParam.getSec_level(), 0) < -999) { + resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(515523, userlanguage))); + continue; + } + //安全级别必须是数字 + if (!Util.null2String(hrmResourceImportParam.getSec_level()).equals("")) { + if (Util.getIntValue(hrmResourceImportParam.getSec_level(), -1000) == -1000) { + resultList.add(createLog(hrmResourceImportParam, "创建", "失败", "安全级别必须是数字")); + continue; + } else { + hrmResourcePO.setSecLevel(Util.getIntValue(hrmResourceImportParam.getSec_level())); + } + } else { + //安全级别为空时取缓存类中的安全级别 + hrmResourcePO.setSecLevel(0); + } + + //职级 + if (isInteger(hrmResourceImportParam.getJob_level())) { + // TODO 职级 + Long jobLevel = hrmResourceImportParam.getJob_level().equals("") ? 0 : Long.parseLong(hrmResourceImportParam.getJob_level()); + hrmResourcePO.setJobLevel(jobLevel); + } else { + hrmResourcePO.setJobLevel(0L); + } + // 职务分类 + Long jobGroupId = null; + if (hrmResourceImportParam.getJob_group_id() != null) { + List postPOS = getPostMapper().listByName(hrmResourceImportParam.getJob_group_id()); + if (CollectionUtils.isNotEmpty(postPOS)) { + jobGroupId = postPOS.get(0).getId(); + } else { + PostPO postPO = PostPO.builder() + .postName(hrmResourceImportParam.getJob_group_id()) + .creator((long) user.getUID()) + .deleteType(0) + .createTime(new Date()) + .build(); + getPostMapper().insertIgnoreNull(postPO); + jobGroupId = postPO.getId(); + } + hrmResourcePO.setJobGroupId(jobGroupId); + } + + // 职务 + if (hrmResourceImportParam.getJob_activity() != null) { + if (null == jobGroupId) { + resultList.add(createLog(hrmResourceImportParam, "创建", "失败", "职务导入错误,未找到对应职务类别")); + continue; + } + PostInfoPO postInfoPO = getPostInfoMapper().getPostInfoByNameAndPostId(hrmResourceImportParam.getJob_activity(), jobGroupId); + if (null == postInfoPO) { + postInfoPO = PostInfoPO.builder() + .postInfoNo(hrmResourceImportParam.getJob_activity()) + .postInfoName(hrmResourceImportParam.getJob_activity()) + .postId(jobGroupId) + .creator((long) user.getUID()) + .deleteType(0) + .createTime(new Date()) + .build(); + getPostInfoMapper().insertIgnoreNull(postInfoPO); + } + hrmResourcePO.setJobActivity(postInfoPO.getId()); + } + + //用工性质 + if (hrmResourceImportParam.getUse_kind() != null) { + int useKind = getUseKind(hrmResourceImportParam.getUse_kind()); + hrmResourcePO.setUseKind(useKind); + } else { + hrmResourcePO.setUseKind(0); + } + + + // 手机 办公电话 + CheckItemBean mobileBean = new CheckItemBean("mobile", hrmResourceImportParam.getMobile()); + ValidateFieldManager.validate(mobileBean); + if (!mobileBean.isPass()) { + resultList.add(createLog(hrmResourceImportParam, "创建", "失败", mobileBean.getCheckMsg())); + continue; + } + CheckItemBean telephoneBean = new CheckItemBean("telephone", hrmResourceImportParam.getTelephone()); + ValidateFieldManager.validate(telephoneBean); + if (!telephoneBean.isPass()) { + resultList.add(createLog(hrmResourceImportParam, "创建", "失败", telephoneBean.getCheckMsg())); + continue; + } + + + ////id,非自动增长 + Long maxId = getResourceMapper().getMaxId(); + id = null == maxId ? 1 : maxId + 1; + hrmResourcePO.setId(id); + + + //密码 加密 + String password_tmp = Util.null2String(hrmResourceImportParam.getPass_word()).trim(); + if ("".equals(password_tmp)) { + password_tmp = "1"; + //人员导入文件中,将密码这一列删除或者密码这一列存在,但是不填写都默认为初始密码 + if (defaultPasswordEnable) { + if (!defaultPassword.equals("")) { + if (weakPasswordDisable && this.hrmWeakPasswordUtil.isWeakPsd(defaultPassword)) { + resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(515436, userlanguage))); + continue; + } else { + password_tmp = defaultPassword; + } + } else { + resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(516347, userlanguage))); + continue; + } + } + } + // 显示顺序 + if (null != hrmResourceImportParam.getShow_order()) { + hrmResourcePO.setShowOrder(hrmResourceImportParam.getShow_order()); + } else { + hrmResourcePO.setShowOrder(id.intValue()); + } + + String[] encrypts = PasswordUtil.encrypt(password_tmp); + HrmFaceCheckManager.setUserPassowrd(id + "", password_tmp); + + String password = encrypts[0]; + hrmResourcePO.setPassWord(password); + + boolean flag = true; + + /*添加人员信息*/ + Map resourceParams = new HashMap<>(); + + String workCode = hrmResourceImportParam.getWork_code(); + workCode = CodeRuleManager.getCodeRuleManager().generateRuleCode(RuleCodeType.USER, workCode); + hrmResourceImportParam.setWork_code(workCode); + + for (String s : fields) { + Field resourcePOClassField = resourcePOClass.getDeclaredField(PageInfoSortUtil.underlineToHump(s)); + Field paramClassDeclaredField = importParamClass.getDeclaredField(s); + + String hrmFieldType = resourcePOClassField.getType().getName(); + String voFieldType = paramClassDeclaredField.getType().getName(); + + resourcePOClassField.setAccessible(true); + paramClassDeclaredField.setAccessible(true); + + //首先取hrm对象中的数据,没有去vo中的 + boolean isNumber = hrmFieldType.endsWith("Long") || hrmFieldType.endsWith("Integer") || hrmFieldType.endsWith("Short") || hrmFieldType.endsWith("Float"); + if (resourcePOClassField.get(hrmResourcePO) != null) { + if (hrmFieldType.endsWith("String")) { + resourceParams.put(s, resourcePOClassField.get(hrmResourcePO)); + } else if (isNumber) { + String insertValueStr = Util.null2String(resourcePOClassField.get(hrmResourcePO)); + if ("".equals(insertValueStr) && recordSet.getDBType().equalsIgnoreCase("postgresql")) { + resourceParams.put(s, null); + } else { + resourceParams.put(s, resourcePOClassField.get(hrmResourcePO)); + } + } + } else if (paramClassDeclaredField.get(hrmResourceImportParam) != null) { + if (voFieldType.endsWith("String")) { + if (Util.null2String(paramClassDeclaredField.get(hrmResourceImportParam)).equals("")) { + resourceParams.put(s, null); + } else { + resourceParams.put(s, paramClassDeclaredField.get(hrmResourceImportParam)); + } + } else if (isNumber) { + String insertValueStr = Util.null2String(paramClassDeclaredField.get(hrmResourceImportParam)); + if ("".equals(insertValueStr) && recordSet.getDBType().equalsIgnoreCase("postgresql")) { + resourceParams.put(s, null); + } else { + resourceParams.put(s, paramClassDeclaredField.get(hrmResourceImportParam)); + } + + } + } + } + resourceParams.put("creator", createrid); + resourceParams.put("delete_type", 0); + resourceParams.put("create_time", date); + ExtendInfoParams infoParams = ExtendInfoParams.builder().tableName("jcl_org_hrmresource").params(resourceParams).build(); + int insertCount = getExtMapper().insertExt(infoParams); + //添加人员信息 + if (insertCount != 1) { + flag = false; + } + + /*写日志*/ + if (flag) { + resultList.add(createLog(hrmResourceImportParam, "创建", "成功", "")); + } else { + resultList.add(createLog(hrmResourceImportParam, "创建", "失败", "系统错误,请联系管理员")); + } + + } else { //更新人员 + if (keyMap.get(key) == null) { + resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getHtmlLabelName(83535, userlanguage))); + continue; + } + + hrmResourceImportParam.setId(Long.parseLong(keyMap.get(key).toString()));//设置id + if (this.checkInfo(hrmResourceImportParam, resultList)) { + continue; + } + + if (hrmResourceImportParam.getAccount_type() == null || "".equalsIgnoreCase(Util.null2String(hrmResourceImportParam.getAccount_type()))) { + if (StringUtil.isNotNull(hrmResourceImportParam.getCertificate_num()) && certificateNums.get(StringUtil.vString(hrmResourceImportParam.getCertificate_num())) != null) { + if (StringUtil.parseToInt(String.valueOf(keyMap.get(key))) != StringUtil.parseToInt(String.valueOf(certificateNums.get(StringUtil.vString(hrmResourceImportParam.getCertificate_num()))))) { + resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getHtmlLabelName(83521, userlanguage))); + continue; + } + } + } else { + if (hrmResourceImportParam.getAccount_type() != null && !"".equals(hrmResourceImportParam.getAccount_type())) { + if ("主账号".equals(hrmResourceImportParam.getAccount_type())) { + if (StringUtil.isNotNull(hrmResourceImportParam.getCertificate_num()) && certificateNums.get(StringUtil.vString(hrmResourceImportParam.getCertificate_num())) != null) { + if (StringUtil.parseToInt(String.valueOf(keyMap.get(key))) != StringUtil.parseToInt(String.valueOf(certificateNums.get(StringUtil.vString(hrmResourceImportParam.getCertificate_num()))))) { + resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getHtmlLabelName(83521, userlanguage))); + continue; + } + } + } + } + } + + String hrmId = String.valueOf(keyMap.get(key)); + + //分部id + String subCompanyNames = hrmResourceImportParam.getCompany_id(); + boolean issameSub = true; + if (!"".equals(Util.null2String(subCompanyNames))) { + if (!subCompanyNames.equals(subCompanyName)) { + subCompanyName = subCompanyNames; + companyId = getSubCompanyId(subCompanyName); + issameSub = false; + } + if (companyId == -9) { + resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getErrorMsgName(56, userlanguage))); + continue; + } + if (companyId == -2) { + resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getHtmlLabelName(126274, userlanguage))); + continue; + } + if (companyId == 0 || companyId == -1) { + resultList.add(createLog(hrmResourceImportParam, "更新", "失败", companyId == 0 ? SystemEnv.getHtmlLabelName(83536, userlanguage) : SystemEnv.getHtmlLabelName(83524, userlanguage))); + continue; + } + + //qc139575 在验证并发非并发之前需要先CkHrmnum + license.CkHrmnum(); + if (StringUtil.parseToInt(license.getConcurrentFlag(), 0) != 1) { + if (!issameSub && new HrmResourceManager().noMore(String.valueOf(companyId))) { + resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getHtmlLabelName(83525, userlanguage))); + continue; + } + } + companyId = 0 == companyId ? null : companyId; + hrmResourcePO.setCompanyId(companyId); + } + + // 部门id + String departmentNames = hrmResourceImportParam.getDepartment_id(); + if (!"".equals(Util.null2String(departmentNames))) { //部门存在时 + if (!issameSub || !departmentNames.equals(departmentName)) { + departmentName = departmentNames; + } + departmentId = getDeptId(departmentName, companyId); + if (departmentId == 0) { + resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getHtmlLabelName(83537, userlanguage))); + continue; + } + if (departmentId == -2) { + resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getHtmlLabelName(126275, userlanguage))); + continue; + } + hrmResourcePO.setDepartmentId(departmentId); + } + + //主账号id-sunjsh + if (hrmResourceImportParam.getAccount_type() != null && !"".equals(hrmResourceImportParam.getAccount_type())) { + if ("主账号".equals(hrmResourceImportParam.getAccount_type())) { + hrmResourcePO.setBelongTo(-1L); + hrmResourcePO.setAccountType(0); + } else if ("次账号".equals(hrmResourceImportParam.getAccount_type())) { + if (hrmResourceImportParam.getBelong_to() != null && !"".equals(hrmResourceImportParam.getBelong_to().trim())) { + long belongto = getBelongId(hrmResourceImportParam.getBelong_to(), keyField); + hrmResourcePO.setBelongTo(belongto); + if (!hrmResourceImportParam.getBelong_to().equals("") && belongto == 0) { + resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getHtmlLabelName(131279, userlanguage))); + continue; + } else { + hrmResourcePO.setAccountType(1); + } + } else { + resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getHtmlLabelName(131279, userlanguage))); + continue; + } + } else { + hrmResourcePO.setBelongTo(-1L); + hrmResourcePO.setAccountType(0); + } + } else if (hrmResourceImportParam.getBelong_to() != null && !"".equals(hrmResourceImportParam.getBelong_to().trim())) { + long belongto = getBelongId(hrmResourceImportParam.getBelong_to(), keyField); + hrmResourcePO.setBelongTo(belongto); + if (!hrmResourceImportParam.getBelong_to().equals("") && belongto == 0) { + resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getHtmlLabelName(131279, userlanguage))); + continue; + } else { + hrmResourcePO.setAccountType(1); + } + } + + // TODO 岗位id + if ("".equals(Util.null2String(hrmResourceImportParam.getJob_title())) && (!"".equals(Util.null2String(hrmResourceImportParam.getJob_activity())) || !"".equals(Util.null2String(hrmResourceImportParam.getJob_group_id())))) { + resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getHtmlLabelName(83544, userlanguage))); + continue; + } + if (!"".equals(Util.null2String(hrmResourceImportParam.getJob_title()))) { + String jobNames = hrmResourceImportParam.getJob_title(); + hrmResourcePO.setJobTitle(getJobTitles(companyId, departmentId, jobNames)); + } + if (Util.getIntValue(hrmId) < 0) { + continue; + } + + // 级序列 + if (!"".equals(Util.null2String(hrmResourceImportParam.getManager_id()))) { + int managerid = getManagerId(hrmResourceImportParam.getManager_id(), keyField); + //如果vo.getManagerid()有值,但manageid未找到,说明填写有误 + if (hrmResourceImportParam.getManager_id() != null && !hrmResourceImportParam.getManager_id().equals("") && managerid == 0) { + resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getHtmlLabelName(83532, userlanguage))); + continue; + } + hrmResourcePO.setManagerId(0 == managerid ? null : managerid); + } else { + hrmResourcePO.setManagerId(null); + } + // 助理id + if (!"".equals(Util.null2String(hrmResourceImportParam.getAssistant_id()))) { + int assistantId; + assistantId = getAssistantId(hrmResourceImportParam.getAssistant_id(), keyField); + if (hrmResourceImportParam.getAssistant_id() != null && !hrmResourceImportParam.getAssistant_id().equals("") && assistantId == 0) { + resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getHtmlLabelName(24678, userlanguage))); + continue; + } + hrmResourcePO.setAssistantId(assistantId); + } + // 办公地点 + if (!"".equals(Util.null2String(hrmResourceImportParam.getLocation_id()))) { + int locationid = getLocationId(hrmResourceImportParam.getLocation_id()); + hrmResourcePO.setLocationId(locationid); + } + + //邮箱-sunjsh + if (hrmResourceImportParam.getEmail() != null) { + if (!"".equals(hrmResourceImportParam.getEmail().trim()) && hrmResourceImportParam.getEmail().contains("*")) { + hrmResourceImportParam.setEmail(null); + } else if ("".equals(hrmResourceImportParam.getEmail().trim())) { + hrmResourcePO.setEmail(""); + } else { + Pattern pattern = Pattern.compile("^([a-zA-Z\\d_\\-.]+)@((\\[\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.)|(([a-zA-Z\\d\\-]+\\.)+))([a-zA-Z]{2,4}|\\d{1,3})(]?)$"); + Matcher matcher = pattern.matcher(hrmResourceImportParam.getEmail()); + if (!matcher.matches()) { + resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getHtmlLabelName(24570, userlanguage))); + continue; + } else { + hrmResourcePO.setEmail(hrmResourceImportParam.getEmail()); + } + } + } + + //mobile-sunjsh + if (hrmResourceImportParam.getMobile() != null) { + if ("".equals(hrmResourceImportParam.getMobile().trim())) hrmResourcePO.setMobile(""); + else if (!"".equals(hrmResourceImportParam.getMobile().trim()) && hrmResourceImportParam.getMobile().contains("*")) + hrmResourceImportParam.setMobile(null); + } + + //工资银行-sunjsh + if (hrmResourceImportParam.getBank_id() != null && !"".equals(hrmResourceImportParam.getBank_id())) { + org.json.JSONObject jsonObject = new org.json.JSONObject(); + jsonObject.put("fieldid", 0); + jsonObject.put("fieldhtmltype", 3); + jsonObject.put("type", 284); + jsonObject.put("dmlurl", ""); + jsonObject.put("fieldvalue", hrmResourceImportParam.getBank_id()); + + String fieldvalue = HrmFieldManager.getReallyFieldvalue(jsonObject); + if (!"".equals(fieldvalue)) { + hrmResourcePO.setBankId(new Integer(fieldvalue)); + } else { + hrmResourcePO.setBankId(this.getBankId(hrmResourceImportParam.getBank_id())); + } + } + + //sunjsh-入职日期 + if (hrmResourceImportParam.getCompany_start_date() != null && !"".equals(hrmResourceImportParam.getCompany_start_date())) { + hrmResourcePO.setCompanyStartDate(hrmResourceImportParam.getCompany_start_date()); + } else { + hrmResourceImportParam.setCompany_start_date(null); + } + + //sunjsh-参加工作日期 + if (hrmResourceImportParam.getWork_start_date() != null && !"".equals(hrmResourceImportParam.getWork_start_date())) { + hrmResourcePO.setWorkStartDate(hrmResourceImportParam.getWork_start_date()); + } else { + hrmResourceImportParam.setWork_start_date(null); + } + // 职称 + if (!"".equals(Util.null2String(hrmResourceImportParam.getJob_call()))) { + hrmResourcePO.setJobCall(getJobCall(hrmResourceImportParam.getJob_call())); + } + // 系统语言,默认简体中文 + if (!"".equals(Util.null2String(hrmResourceImportParam.getSystem_language()))) { + int systemlanguage = getSystemLanguage(hrmResourceImportParam.getSystem_language()); + + if (systemlanguage == -1) { //只能选择简体中文|Englisth|繁体中文 + resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getHtmlLabelName(518929, userlanguage))); + continue; + } + //系统不支持多语言 + if (systemlanguage == 0) { + resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getHtmlLabelName(84810, userlanguage))); + continue; + } + hrmResourcePO.setSystemLanguage(systemlanguage); + } + + // 性别,为空或其他情况统一为0(男) + if (hrmResourceImportParam.getSex() == null) { + hrmResourcePO.setSex("0"); + } else if (!"".equals(Util.null2String(hrmResourceImportParam.getSex()))) { + String sex = hrmResourceImportParam.getSex().equals("女") ? "1" : "0"; + hrmResourcePO.setSex(sex); + } + + // 婚姻状况,如果不是以下选项,则默认为未婚 + if (!"".equals(Util.null2String(hrmResourceImportParam.getMarital_status()))) { + String maritalstatus = hrmResourceImportParam.getMarital_status().equals("已婚") ? "1" : hrmResourceImportParam.getMarital_status().equals("离异") ? "2" : "0"; + hrmResourcePO.setMaritalStatus(maritalstatus); + } + + // 员工状态 + if (!"".equals(Util.null2String(hrmResourceImportParam.getStatus()))) { + int status = getStatus(hrmResourceImportParam.getStatus()); + hrmResourcePO.setStatus(status); + } else { + hrmResourcePO.setStatus(0); + } + + // 人员密级 + if (!"".equals(Util.null2String(hrmResourceImportParam.getClassification()))) { + int classification = getClassification(hrmResourceImportParam.getClassification()); + hrmResourcePO.setClassification(classification); + } + + // 学历 + if (!"".equals(Util.null2String(hrmResourceImportParam.getEducation_level()))) { + int educationlevel = getEducationLevel(hrmResourceImportParam.getEducation_level()); + hrmResourcePO.setEducationLevel(educationlevel); + } + + // 工会会员,默认为是 + if (!"".equals(Util.null2String(hrmResourceImportParam.getIslabouunion()))) { + String islabouunion = hrmResourceImportParam.getIslabouunion().equals("是") ? "1" : "0"; + hrmResourcePO.setIslabouunion(islabouunion); + } + + // 健康状况 + if (!"".equals(Util.null2String(hrmResourceImportParam.getHealth_info()))) { + String healthinfo = getHealthInfo(hrmResourceImportParam.getHealth_info()); + hrmResourcePO.setHealthInfo(healthinfo); + } + + //安全级别不能大于999 + if (Util.getIntValue(hrmResourceImportParam.getSec_level(), 0) > 999) { + resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getHtmlLabelName(515522, userlanguage))); + continue; + } + //安全级别不能小于-999 + if (Util.getIntValue(hrmResourceImportParam.getSec_level(), 0) < -999) { + resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getHtmlLabelName(515523, userlanguage))); + continue; + } + //安全级别必须是数字 + if (!Util.null2String(hrmResourceImportParam.getSec_level()).equals("")) { + if (Util.getIntValue(hrmResourceImportParam.getSec_level(), -1000) == -1000) { + resultList.add(createLog(hrmResourceImportParam, "更新", "失败", "安全级别必须是数字")); + continue; + } else { + hrmResourcePO.setSecLevel(Util.getIntValue(hrmResourceImportParam.getSec_level())); + } + } + + //职级 + if (isInteger(hrmResourceImportParam.getJob_level())) { + int joblevel = hrmResourceImportParam.getJob_level().equals("") ? 0 : Integer.parseInt(hrmResourceImportParam.getJob_level()); + hrmResourcePO.setJobLevel((long) joblevel); + } + + // 职务分类 + Long jobGroupId = null; + if (hrmResourceImportParam.getJob_group_id() != null) { + List postPOS = getPostMapper().listByName(hrmResourceImportParam.getJob_group_id()); + if (CollectionUtils.isNotEmpty(postPOS)) { + jobGroupId = postPOS.get(0).getId(); + } else { + PostPO postPO = PostPO.builder() + .postName(hrmResourceImportParam.getJob_group_id()) + .creator((long) user.getUID()) + .deleteType(0) + .createTime(new Date()) + .build(); + getPostMapper().insertIgnoreNull(postPO); + jobGroupId = postPO.getId(); + } + hrmResourcePO.setJobGroupId(jobGroupId); + } + + // 职务 + if (hrmResourceImportParam.getJob_activity() != null) { + if (null == jobGroupId) { + resultList.add(createLog(hrmResourceImportParam, "创建", "失败", "职务导入错误,未找到对应职务类别")); + continue; + } + PostInfoPO postInfoPO = getPostInfoMapper().getPostInfoByNameAndPostId(hrmResourceImportParam.getJob_activity(), jobGroupId); + if (null == postInfoPO) { + postInfoPO = PostInfoPO.builder() + .postInfoNo(hrmResourceImportParam.getJob_activity()) + .postInfoName(hrmResourceImportParam.getJob_activity()) + .postId(jobGroupId) + .creator((long) user.getUID()) + .deleteType(0) + .createTime(new Date()) + .build(); + getPostInfoMapper().insertIgnoreNull(postInfoPO); + } + hrmResourcePO.setJobActivity(postInfoPO.getId()); + } + + //用工性质 + if (hrmResourceImportParam.getUse_kind() != null) { + int usekind = getUseKind(hrmResourceImportParam.getUse_kind()); + hrmResourcePO.setUseKind(usekind); + } + + // 手机 办公电话 + CheckItemBean mobileBean = new CheckItemBean("mobile", hrmResourceImportParam.getMobile()); + ValidateFieldManager.validate(mobileBean); + if (!mobileBean.isPass()) { + resultList.add(createLog(hrmResourceImportParam, "更新", "失败", mobileBean.getCheckMsg())); + continue; + } + CheckItemBean telephoneBean = new CheckItemBean("telephone", hrmResourceImportParam.getTelephone()); + ValidateFieldManager.validate(telephoneBean); + if (!telephoneBean.isPass()) { + resultList.add(createLog(hrmResourceImportParam, "更新", "失败", telephoneBean.getCheckMsg())); + continue; + } + + + //密码 加密 + if (!"".equals(Util.null2String(hrmResourceImportParam.getPass_word()))) { + + String orgPwd = "1"; + if (!"".equals(hrmResourceImportParam.getPass_word())) + orgPwd = hrmResourceImportParam.getPass_word(); + String[] pwdArr = PasswordUtil.encrypt(orgPwd); + String salt = pwdArr[1]; + hrmResourcePO.setPassWord(pwdArr[0]); + + PasswordUtil.updateResourceSalt(keyMap.get(key) + "", salt); + HrmFaceCheckManager.setUserPassowrd(keyMap.get(key) + "", orgPwd); + + } + Map resourceParams = new HashMap<>(); + + for (int k = 1; k < fields.length; k++) { + Field hrmField = resourcePOClass.getDeclaredField(PageInfoSortUtil.underlineToHump(fields[k])); + Field paramClassDeclaredField = importParamClass.getDeclaredField(fields[k]); + + String hrmFieldType = hrmField.getType().getName(); + String voFieldType = paramClassDeclaredField.getType().getName(); + + hrmField.setAccessible(true); + paramClassDeclaredField.setAccessible(true); + + if (Util.null2String(hrmField.get(hrmResourcePO)).trim().length() > 0) { + if (hrmFieldType.endsWith("String")) { + resourceParams.put(fields[k], hrmField.get(hrmResourcePO)); + } else if (hrmFieldType.endsWith("Long") || hrmFieldType.endsWith("Integer") || hrmFieldType.endsWith("Short") || hrmFieldType.endsWith("Float")) { + resourceParams.put(fields[k], hrmField.get(hrmResourcePO)); + } + } else if (Util.null2String(paramClassDeclaredField.get(hrmResourceImportParam)).trim().length() > 0) { + if (voFieldType.endsWith("String")) { + if (Util.null2String(paramClassDeclaredField.get(hrmResourceImportParam)).equals("")) { + resourceParams.put(fields[k], null); + } else { + resourceParams.put(fields[k], paramClassDeclaredField.get(hrmResourceImportParam)); + } + } else if (voFieldType.endsWith("Long") || voFieldType.endsWith("Integer") || voFieldType.endsWith("Short") || voFieldType.endsWith("Float")) { + if (voFieldType.endsWith("Integer") && (paramClassDeclaredField.get(hrmResourceImportParam).equals(0x7fffffff))) { + resourceParams.put(fields[k], null); + } else { + resourceParams.put(fields[k], paramClassDeclaredField.get(hrmResourceImportParam)); + } + } + } + } + resourceParams.put("update_time", DateUtil.getCurrentDate()); + ExtendInfoParams infoParams = ExtendInfoParams.builder().id((long) keyMap.get(key)).tableName("jcl_org_hrmresource").params(resourceParams).build(); + getExtMapper().updateExt(infoParams); + } + } catch (Exception e) { + //数据异常 + new BaseBean().writeLog(e); + } + } + try { + HrmTlevelManager.setUpdate(); + } catch (Exception e) { + new BaseBean().writeLog(e); + } + + Map params = new HashMap<>(); + params.put("pId", this.pId); + params.put("status", "over"); + importLogService.saveImportLogStatus(params, user); + + } catch (Exception e) { + new BaseBean().writeLog(e); + Map params = new HashMap<>(); + params.put("pId", this.pId); + params.put("status", "error"); + importLogService.saveImportLogStatus(params, user); + } + } + + + /** + * 根据分部名称获取分部Id,不存在就创建 + * + * @param subCompanyName 分部名称 eg:泛微广东>泛微深圳 + */ + public Long getSubCompanyId(String subCompanyName) { + + String[] subCompanyNames = subCompanyName.split(">"); + if (subCompanyNames.length >= 10) { + return -9L; + } + long currentId = 0L; + long parentId = 0L; + int curCount = 0; + + for (String companyName : subCompanyNames) { + if (StringUtil.isNull(companyName)) { + continue; + } + + Long companyId = getCompMapper().getIdByNameAndPid(companyName.trim(), parentId); + currentId = null == companyId ? 0 : companyId; + + if (parentId == 0 && currentId == 0) { + curCount = getCompMapper().countTopCompany(0L); + + } + + //added by wcd 2015-02-06 [限制分部数] + if (currentId == 0) { + if (scCount == 0 || curCount < scCount) { + // 如果编码为空 自动生成编码 + String compNo = ""; + try { + compNo = CodeRuleManager.getCodeRuleManager().generateRuleCode(RuleCodeType.SUBCOMPANY, compNo); + } catch (Exception e) { + new BaseBean().writeLog(e); + } + CompPO compPO = CompPO.builder() + .compNo(compNo) + .compName(companyName.trim()) + .compNameShort(companyName.trim()) + .parentCompany(0 == parentId ? null : parentId) + .creator((long) user.getUID()) + .deleteType(0) + .createTime(new Date()) + .build(); + getCompMapper().insertIgnoreNull(compPO); + currentId = compPO.getId().intValue(); + + } else { + currentId = -1; + } + } + parentId = currentId; + } + return currentId; + } + + /** + * 获取部门id,不存在就创建 + * + * @param deptNames 部门名称 + * @param companyId 所属分部id + */ + public Long getDeptId(String deptNames, long companyId) { + + String[] deptNameArray = deptNames.split(">"); + long currentId = 0L; + long parentId = 0L; + + for (String deptName : deptNameArray) { + if (deptName == null || deptName.equals("")) { + continue; + } + Long departmentId = getDepartmentMapper().getIdByNameAndPid(deptName.trim(), companyId, parentId); + currentId = null == departmentId ? 0 : departmentId; + + if (currentId == 0) { + // 如果编码为空 自动生成编码 + String deptNo = ""; + try { + deptNo = CodeRuleManager.getCodeRuleManager().generateRuleCode(RuleCodeType.DEPARTMENT, deptNo); + } catch (Exception e) { + new BaseBean().writeLog(e); + } + DepartmentPO departmentPO = DepartmentPO.builder() + .deptNo(deptNo) + .deptName(deptName.trim()) + .deptNameShort(deptName.trim()) + .parentComp(0 == companyId ? null : companyId) + .parentDept(0 == parentId ? null : parentId) + .forbiddenTag(0) + .creator((long) user.getUID()) + .deleteType(0) + .createTime(new Date()) + .build(); + getDepartmentMapper().insertIgnoreNull(departmentPO); + currentId = departmentPO.getId().intValue(); + } + parentId = currentId; + } + return currentId; + } + + public Long getJobTitles(Long companyId, Long departmentId, String jobNames) { + + + String[] jobNameArray = jobNames.split(">"); + long currentId = 0L; + long parentId = 0L; + + for (String jobName : jobNameArray) { + if (jobName == null || jobName.equals("")) { + continue; + } + Long jobId = getJobMapper().getIdByNameAndPid(jobName.trim(), companyId, departmentId, parentId); + currentId = null == jobId ? 0 : jobId; + if (currentId == 0) { + // 如果编码为空 自动生成编码 + String jobNo = ""; + try { + jobNo = CodeRuleManager.getCodeRuleManager().generateRuleCode(RuleCodeType.JOBTITLES, jobNo); + } catch (Exception e) { + new BaseBean().writeLog(e); + } + JobPO jobPO = JobPO.builder() + .jobNo(jobNo) + .jobName(jobName) + .parentComp(0 == companyId ? null : companyId) + .parentDept(0 == departmentId ? null : departmentId) + .parentJob(0 == parentId ? null : parentId) + .forbiddenTag(0) + .creator((long) user.getUID()) + .deleteType(0) + .createTime(new Date()) + .build(); + getJobMapper().insertIgnoreNull(jobPO); + currentId = jobPO.getId(); + } + parentId = currentId; + } + return currentId; + } + + + /** + * 获取直接上级Id和所有上级 + * + * @param keyFieldValue 上级标记值,eg:编号 + * @param keyField 关键字段 + */ + public int getManagerId(String keyFieldValue, String keyField) { + + int managerId = 0; + if (!keyFieldValue.equals("")) { + Integer userId = getResourceMapper().getIdByKeyField(keyField, keyFieldValue); + managerId = null == userId ? 0 : userId; + } + return managerId; + } + + /** + * 获取助理id + * + * @param keyFieldValue 助理标记 + * @param keyField 关键字段 + */ + public int getAssistantId(String keyFieldValue, String keyField) { + return getResourceId(keyFieldValue, keyField, 0); + } + + private int getResourceId(String keyFieldValue, String keyField, int resourceId) { + if (!keyFieldValue.equals("")) { + Integer userId = getResourceMapper().getIdByKeyField(keyField, keyFieldValue); + resourceId = null == userId ? 0 : userId; + } + return resourceId; + } + + /** + * 获取主账号id + * + * @param keyFieldValue 主账号标记 + * @param keyField 关键字段 + */ + public Long getBelongId(String keyFieldValue, String keyField) { + return (long) getResourceId(keyFieldValue, keyField, -1); + } + + /** + * 办公地点id + * + * @param locationName 办公地点名称 + */ + public int getLocationId(String locationName) { + int locationId = 0; + if (!locationName.equals("")) { + locationId = locationMap.getOrDefault(locationName, 0); + if (locationId == 0) { + Map hrmLocationsMap = new HashMap<>(); + hrmLocationsMap.put("locationname", locationName); + hrmLocationsMap.put("locationdesc", locationName); + hrmLocationsMap.put("countryid", 1); + ExtendInfoParams extendInfoParams = ExtendInfoParams.builder().params(hrmLocationsMap).tableName("HrmLocations").build(); + getExtMapper().insertExt(extendInfoParams); + locationId = extendInfoParams.getId().intValue(); + locationMap.put(locationName, locationId); + } + } + return locationId; + } + + /** + * 用工性质id + * + * @param useKindName 用工性质名称 + */ + public int getUseKind(String useKindName) { + int usekindid = 0; + if (!useKindName.equals("")) { + usekindid = usekindMap.getOrDefault(useKindName, 0); + if (usekindid == 0) { + Map hrmUseKindMap = new HashMap<>(); + hrmUseKindMap.put("name", useKindName); + hrmUseKindMap.put("description", useKindName); + ExtendInfoParams extendInfoParams = ExtendInfoParams.builder().params(hrmUseKindMap).tableName("HrmUseKind").build(); + getExtMapper().insertExt(extendInfoParams); + usekindid = extendInfoParams.getId().intValue(); + usekindMap.put(useKindName, usekindid); + } + } + return usekindid; + } + + /** + * 职称 + * + * @param jobCall 职称名称 + */ + public int getJobCall(String jobCall) { + int jobCallId = 0; + if (!jobCall.equals("")) { + jobCallId = jobcallMap.getOrDefault(jobCall, 0); + if (jobCallId == 0) { + Map hrmJobCallMap = new HashMap<>(); + hrmJobCallMap.put("name", jobCall); + ExtendInfoParams extendInfoParams = ExtendInfoParams.builder().params(hrmJobCallMap).tableName("HrmJobCall").build(); + getExtMapper().insertExt(extendInfoParams); + jobCallId = extendInfoParams.getId().intValue(); + jobcallMap.put(jobCall, jobCallId); + } + } + return jobCallId; + } + + /** + * 系统语言 + * + * @param language 语言 eg:简体中文,English,繁體中文 + */ + public int getSystemLanguage(String language) { + int systemlanguageid = 7; //系统语言默认为中文 + //如果系统不支持多语言,则返回0 + if ((language.equals("English") || language.equals("繁體中文")) && !multilanguage.equalsIgnoreCase("y")) { + return 0; + } + if (!language.equals("")) { + if (language.equals("简体中文")) { + systemlanguageid = cnLanguageId; + } else { + systemlanguageid = sysLanguage.getOrDefault(language, -1); + } + } + return systemlanguageid; + } + + /** + * 工资银行id + * + * @param bank 办公地点名称 + */ + public int getBankId(String bank) { + int id = 0; + if (!bank.equals("")) { + Map hrmBankMap = new HashMap<>(); + hrmBankMap.put("bankname", bank); + hrmBankMap.put("bankdesc", bank); + ExtendInfoParams extendInfoParams = ExtendInfoParams.builder().params(hrmBankMap).tableName("hrmbank").build(); + getExtMapper().insertExt(extendInfoParams); + id = extendInfoParams.getId().intValue(); + } + return id; + } + + /** + * 获取员工状态 + * + * @param status 员工状态值 + */ + public int getStatus(String status) { + int statusId; + switch (status) { + case "试用": + statusId = 0; + break; + case "临时": + statusId = 2; + break; + case "试用延期": + statusId = 3; + break; + case "解聘": + statusId = 4; + break; + case "离职": + statusId = 5; + break; + case "退休": + statusId = 6; + break; + case "无效": + statusId = 7; + break; + default: + statusId = 1; + break; + } + return statusId; + } + + /** + * 获取人员密级 + */ + public int getClassification(String classification) { + + int classificationId; + switch (classification) { + case "核心": + classificationId = 0; + break; + case "重要": + classificationId = 1; + break; + case "一般": + classificationId = 2; + break; + default: + classificationId = 3; + break; + } + return classificationId; + } + + /** + * 获取学历Id + * + * @param educationLevel 学历值 + */ + public int getEducationLevel(String educationLevel) { + int educationLevelId = 0; + if (!educationLevel.equals("")) { + educationLevelId = educationlevelMap.getOrDefault(educationLevel, 0); + if (educationLevelId == 0) { + Map hrmEducationLevelMap = new HashMap<>(); + hrmEducationLevelMap.put("name", educationLevel); + hrmEducationLevelMap.put("description", educationLevel); + ExtendInfoParams extendInfoParams = ExtendInfoParams.builder().params(hrmEducationLevelMap).tableName("HrmEducationLevel").build(); + getExtMapper().insertExt(extendInfoParams); + educationLevelId = extendInfoParams.getId().intValue(); + educationlevelMap.put(educationLevel, educationLevelId); + } + } + return educationLevelId; + } + + /** + * 获取身体状况 + */ + public String getHealthInfo(String healthInfo) { + String healthInfoId; + switch (healthInfo) { + case "良好": + healthInfoId = "1"; + break; + case "一般": + healthInfoId = "2"; + break; + case "较差": + healthInfoId = "3"; + break; + default: + healthInfoId = "0"; + break; + } + return healthInfoId; + } + + /** + * 获取id与workcode_lastname 键值对,用于对导入数据重复性判断 + * + * @param keyField key值,重复性验证字段 + */ + public void getKeyMap(String keyField) { + List keyMaps = getResourceMapper().getKeyMapByKetField(keyField); + String cerNum; + for (JSONObject map : keyMaps) { + { + for (String key : checkKeys) { + Map checkInfo = checkInfos.get(key); + if (checkInfo == null) { + checkInfo = new HashMap<>(); + checkInfos.put(key, checkInfo); + } else { + checkInfo = checkInfos.get(key); + } + String val = Util.null2String(map.getString(key)); + checkInfo.put(val, map.getString("id")); + checkInfos.put(key, checkInfo); + } + + cerNum = map.getString("certificate_num"); + keyMap.put(map.getString(keyField), map.getInteger("id")); + String accountType = map.getString("account_type"); + if (!"1".equalsIgnoreCase(accountType)) { + if (StringUtil.isNotNull(cerNum)) { + certificateNums.put(StringUtil.vString(cerNum), map.getInteger("id")); + } + } + } + } + + } + + /** + * 执行插入操作 + */ + + public boolean execSql(String sql) { + RecordSet recordSet = new RecordSet(); + return recordSet.execute(sql); + } + + /** + * 创建日志对象 + * + * @param importParam HrmResourceVo 人员信息对象 + * @param operation 操作类型 验证|创建|更新 + * @param status 状态 成功|失败 + * @param reason 失败原因 + * @return ImportLog对象 + */ + public ImportLog createLog(HrmResourceImportParam importParam, String operation, String status, String reason) { + ImportLog log = new ImportLog(); + + log.setWorkCode(importParam.getWork_code()); //编号 + log.setLastname(importParam.getLast_name()); //用户名 + log.setLoginid(importParam.getLogin_id()); //登录名 + log.setOperation(operation); //操作类型 + if (importParam.getCompany_id() != null && importParam.getDepartment_id() != null) + log.setDepartment(importParam.getCompany_id() + ">" + importParam.getDepartment_id()); //分部部门 + else log.setDepartment(""); + log.setStatus(status); //状态,成功、失败 + log.setReason(reason); //原因 + + try { + ImportLogService importLogService = ServiceUtil.getService(ImportLogServiceImpl.class, user); + String relatedName = ""; + switch (this.keyField) { + case "work_code": + relatedName = log.getWorkCode(); + break; + case "login_id": + relatedName = log.getLoginid(); + break; + case "last_name": + relatedName = log.getLastname(); + break; + } + + Map params = new HashMap<>(); + params.put("pId", this.pId); + params.put("lineNum", this.rowNum + 2);//修正偏移量错误 + params.put("relatedName", relatedName); + params.put("msg", log.getStatus().equals("成功") ? relatedName + "导入成功!" : log.getReason()); + params.put("status", log.getStatus().equals("成功") ? "1" : "0"); + importLogService.saveImportDeitalLog(params, user); + } catch (Exception e) { + new BaseBean().writeLog(e); + } + return log; + } + + //整数判断 + public static boolean isInteger(String str) { + if (str == null) return false; + Pattern pattern = Pattern.compile("\\d+"); + return pattern.matcher(str).matches(); + } + + + private boolean checkInfo(HrmResourceImportParam importParam, List resultList) { + //新增账号、工号唯一性校验 + for (String key : checkKeys) { + Map checkInfo = checkInfos.get(key); + if (checkInfo != null && !checkInfo.isEmpty()) { + String val = ""; + String errorMsg = ""; + switch (key) { + case "login_id": + val = Util.null2String(importParam.getLogin_id()).trim(); + errorMsg = SystemEnv.getHtmlLabelName(522076, userlanguage); + break; + case "work_code": + val = Util.null2String(importParam.getWork_code()).trim(); + errorMsg = SystemEnv.getHtmlLabelName(520197, userlanguage); + break; + case "certificate_num": + val = Util.null2String(importParam.getCertificate_num()).trim(); + errorMsg = SystemEnv.getHtmlLabelName(83521, userlanguage); + break; + } + int reosurceid = Util.getIntValue(checkInfo.get(val)); + if (importParam.getId() != null && importParam.getId() == reosurceid) { + //如果是当前记录,不需要校验 + continue; + } + + if (reosurceid > 0 && val.length() > 0) { + resultList.add(createLog(hrmResourceImportParam, this.operateType.equals("add") ? "创建" : "更新", "失败", errorMsg)); + return true; + } + } + } + return false; + } + +} diff --git a/src/com/engine/organization/util/saveimport/SaveImportProcessUtil.java b/src/com/engine/organization/util/saveimport/SaveImportProcessUtil.java new file mode 100644 index 00000000..534c101e --- /dev/null +++ b/src/com/engine/organization/util/saveimport/SaveImportProcessUtil.java @@ -0,0 +1,628 @@ +package com.engine.organization.util.saveimport; + +import com.engine.common.util.ParamUtil; +import com.engine.common.util.ServiceUtil; +import com.engine.hrm.service.ImportLogService; +import com.engine.hrm.service.impl.ImportLogServiceImpl; +import org.apache.poi.hssf.usermodel.*; +import org.apache.poi.poifs.filesystem.POIFSFileSystem; +import org.jetbrains.annotations.NotNull; +import weaver.file.ImageFileManager; +import weaver.general.BaseBean; +import weaver.general.Util; +import weaver.hrm.User; +import weaver.hrm.excelimport.*; +import weaver.systeminfo.SystemEnv; + +import javax.servlet.http.HttpServletRequest; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.text.SimpleDateFormat; +import java.util.*; + +/** + * @author:dxfeng + * @createTime: 2022/06/30 + * @version: 1.0 + */ +public class SaveImportProcessUtil { + /** + * 导入类型 + */ + private String importType; + + /** + * excel页签 + */ + private HSSFSheet sheet; + /** + * 存储报错信息位置 + */ + private final List lsImportSourceMap = new ArrayList<>(); + /** + * 存储报错信息 + */ + private final List errorInfo = new ArrayList<>(); + /** + * 存储参数类型名称 + */ + private final Map parameterTypes = new HashMap<>(); + /** + * 字段类型 + */ + private final Map fieldTypes = new HashMap<>(); + /** + * 类名 + */ + private final Map mapImportSource = new HashMap<>(); + /** + * 导入类型名称 + */ + private final Map mapImportSourceName = new HashMap<>(); + /** + * excel文件中对应的字段别名 + */ + private final Map mapImportSourceField = new HashMap<>(); + /** + * excel文件中对应的字段名称 + */ + private final Map mapImportSourceFieldName = new HashMap<>(); + /** + * 多语言--中文 + */ + private int userLanguage = 7; + /** + * 字段名 + */ + private String[] voFields; + /** + * 类 + */ + private Class importSourceClass; + /** + * 字段标识 + */ + private String keyField = ""; + /** + * 操作人 + */ + private String creator = ""; + /** + * 导入类型 + */ + private String operateType = ""; + /** + * 常用组成员导入为覆盖时,清除旧数据只需要执行一次。false--还未清除旧数据、true--旧数据已经清除 + */ + private boolean isDeleted = false; + + private User user; + private int pId = 0; + + /** + * 客户端操作IP + */ + + public SaveImportProcessUtil() { + // TODO 组织导入类 + mapImportSource.put("company", new String[]{CompanyImportUtil.class.getName()}); + + mapImportSource.put("jobtitle", new String[]{HrmJobTitle.class.getName()}); + mapImportSource.put("group", new String[]{HrmGroup.class.getName()}); + mapImportSource.put("groupMember", new String[]{HrmGroupMember.class.getName()}); + mapImportSource.put("resourcedetial", new String[]{HrmFamilyInfo.class.getName(), + HrmLanguageAbility.class.getName(), + HrmEducationInfo.class.getName(), + HrmWorkResume.class.getName(), + HrmTrainBeforeWork.class.getName(), + HrmCertification.class.getName(), + HrmRewardBeforeWork.class.getName()}); + mapImportSource.put("city", new String[]{HrmCity.class.getName()}); + mapImportSource.put("location", new String[]{HrmLoaction.class.getName()}); + mapImportSource.put("special", new String[]{HrmSpeciality.class.getName()}); + mapImportSource.put("area", new String[]{HrmArea.class.getName()}); + mapImportSource.put("sensitiveword", new String[]{SensitiveWord.class.getName()}); + + mapImportSourceName.put("company", "分部、部门导入"); + mapImportSourceName.put("jobtitle", "岗位体系导入"); + mapImportSourceName.put("group", "常用组信息导入"); + mapImportSourceName.put("groupMember", "常用组成员导入"); + mapImportSourceName.put("resourcedetial", "个人数据导入"); + mapImportSourceName.put("city", "位置信息导入"); + mapImportSourceName.put("location", "办公地点信息导入"); + mapImportSourceName.put("special", "专业信息导入"); + mapImportSourceName.put("area", "行政区域导入"); + mapImportSourceName.put("sensitiveword", "敏感词"); + + mapImportSourceField.put("company", new String[]{"subcompanyname,departmentname,subcompanyshoworder,subcompanycode,departmentshoworder,departmentcode"}); + mapImportSourceField.put("jobtitle", new String[]{"jobtitlemark,jobtitlename,jobtitlecode,jobactivityname,jobgroupname,jobresponsibility,jobcompetency,jobtitleremark"}); + mapImportSourceField.put("group", new String[]{"typename,groupname,username,keycode"}); + mapImportSourceField.put("groupMember", new String[]{"workCode,lastName,loginId"}); + mapImportSourceField.put("resourcedetial", new String[]{"lastname,loginid,member,title,company,jobtitle,address", + "lastname,loginid,language,level_n,memo", + "lastname,loginid,school,speciality,startdate,enddate,educationlevel,studydesc", + "lastname,loginid,company,startdate,enddate,jobtitle,workdesc,leavereason", + "lastname,loginid,trainname,trainstartdate,trainenddate,trainresource,trainmemo", + "lastname,loginid,certname,datefrom,dateto,awardfrom", + "lastname,loginid,rewardname,rewarddate,rewardmemo"}); + mapImportSourceField.put("city", new String[]{"位置信息导入"}); + mapImportSourceField.put("location", new String[]{"locationname,locationdesc,locationcityname,countryname,showorder"}); + mapImportSourceField.put("special", new String[]{"name,description"}); + mapImportSourceField.put("area", new String[]{"countryname,provincename,cityname,citytwoname,longitude,latitude"}); + mapImportSourceField.put("sensitiveword", new String[]{"word,description,wordtype,handleway"}); + + + mapImportSourceFieldName.put("company", new String[]{"分部[必填],部门,分部显示顺序,分部编号,部门显示顺序,部门编号"}); + mapImportSourceFieldName.put("jobtitle", new String[]{"岗位简称[必填],岗位全称[必填],岗位编号,所属职务[必填],职务类别[必填],岗位职责,任职资格,备注"}); + mapImportSourceFieldName.put("group", new String[]{"类型[必填],名称[必填],成员姓名[必填],成员登录名[必填]"}); + mapImportSourceFieldName.put("groupMember", new String[]{"编号,姓名,登录名"}); + mapImportSourceFieldName.put("resourcedetial", new String[]{"员工姓名[必填],员工登录名[必填],成员,称谓,工作单位,职务,地址", + "员工姓名[必填],员工登录名[必填],语言,水平,备注", + "员工姓名[必填],员工登录名[必填],学校名称,专业,开始日期,结束日期,学历,详细描述", + "员工姓名[必填],员工登录名[必填],公司名称,开始日期,结束日期,职务,工作描述,离开原因", + "员工姓名[必填],员工登录名[必填],培训名称,开始日期,结束日期,培训单位,备注", + "员工姓名[必填],员工登录名[必填],名称,开始日期,结束日期,颁发单位", + "员工姓名[必填],员工登录名[必填],奖惩名称,奖惩日期,备注"}); + mapImportSourceFieldName.put("city", new String[]{"位置信息导入"}); + mapImportSourceFieldName.put("location", new String[]{"办公地点简称[必填],办公地点全称[必填],城市[必填],国家,顺序"}); + mapImportSourceFieldName.put("special", new String[]{"专业名称[必填],专业描述[必填]"}); + mapImportSourceFieldName.put("area", new String[]{"国家[必填],省份,城市,区县,经度,纬度"}); + mapImportSourceFieldName.put("sensitiveword", new String[]{"敏感词[必填],详细描述,所属分类[必填],处理方式[必填]"}); + } + + /** + * 读取数据 + * + * @param request 请求 + */ + public List importXls(HttpServletRequest request) { + ImportLogService importLogService = ServiceUtil.getService(ImportLogServiceImpl.class, user); + Map params; + try { + this.user = (User) request.getSession(true).getAttribute("weaver_user@bean"); + String filename = request.getParameter("excelfile"); + this.importType = Util.null2String(request.getParameter("importType")); + this.keyField = Util.null2String(request.getParameter("keyField")); + this.creator = "" + user.getUID(); + this.userLanguage = Util.getIntValue(request.getParameter("userlanguage"), 7); + this.operateType = Util.null2String(request.getParameter("operateType")); + // 常用组导入为覆盖时,已经清除掉旧数据的常用组ID集合(暂时只用于常用组的导入) + List deletedGroupId = new ArrayList<>(); + + ImageFileManager manager = new ImageFileManager(); + manager.getImageFileInfoById(Util.getIntValue(filename)); + HSSFWorkbook workbook = new HSSFWorkbook(new POIFSFileSystem(manager.getInputStream())); + + params = ParamUtil.request2Map(request); + Map retmap = importLogService.saveImportLog(params, request, user); + if (Util.null2String(retmap.get("status")).equals("1")) { + this.pId = Util.getIntValue(Util.null2String(retmap.get("pId"))); + String pIdName = "hrm" + this.importType + "PId"; + request.getSession(true).setAttribute(pIdName, this.pId); + } + + String[] tmpMapImportSource = mapImportSource.get(this.importType); + int idx = 0; + for (String tmpImportSource : tmpMapImportSource) { + idx++; + this.sheet = workbook.getSheetAt(idx); + importSourceClass = Class.forName(tmpImportSource); + voFields = mapImportSourceField.get(this.importType)[idx - 1].split(","); + initReflectParam(); + /*校验模板有效性 */ + if (idx == 1) { + String[] importSourceFieldName = mapImportSourceFieldName.get(this.importType); + String valExcelTempInfo = valExcelTemp(importSourceFieldName[idx - 1]); + if (valExcelTempInfo.length() > 0) { + this.errorInfo.add(valExcelTempInfo); + break; + } + } + readexcel(); + String importSourceName; + if (tmpImportSource.equals(HrmFamilyInfo.class.getName())) { + importSourceName = SystemEnv.getHtmlLabelName(814, userLanguage); + } else if (tmpImportSource.equals(HrmLanguageAbility.class.getName())) { + importSourceName = SystemEnv.getHtmlLabelName(815, userLanguage); + } else if (tmpImportSource.equals(HrmEducationInfo.class.getName())) { + importSourceName = SystemEnv.getHtmlLabelName(813, userLanguage); + } else if (tmpImportSource.equals(HrmWorkResume.class.getName())) { + importSourceName = SystemEnv.getHtmlLabelName(15716, userLanguage); + } else if (tmpImportSource.equals(HrmTrainBeforeWork.class.getName())) { + importSourceName = SystemEnv.getHtmlLabelName(15717, userLanguage); + } else if (tmpImportSource.equals(HrmCertification.class.getName())) { + importSourceName = SystemEnv.getHtmlLabelName(1502, userLanguage); + } else if (tmpImportSource.equals(HrmRewardBeforeWork.class.getName())) { + importSourceName = SystemEnv.getHtmlLabelName(15718, userLanguage); + } else { + importSourceName = mapImportSourceName.get(this.importType); + } + Object obj = null; + Method method; + String flag; + String valErrorInfo; + if (lsImportSourceMap.size() == 0) { + this.errorInfo.add("【" + importSourceName + "】" + SystemEnv.getHtmlLabelName(34195, userLanguage) + "!"); + } + if ("area".equals(importType)) { + //如果是行政区域导入,先删除脏数据 + HrmArea.deleteDirtyData(); + } + for (int i = 0; i < lsImportSourceMap.size(); i++) { + obj = lsImportSourceMap.get(i); + if (importType.equals("groupMember")) { + String groupId = Util.null2String(request.getParameter("groupid")); + + method = importSourceClass.getMethod("setGroupid", String.class); + method.invoke(obj, groupId); + } + + method = importSourceClass.getMethod("setUserLanguage", String.class); + method.invoke(obj, "" + userLanguage); + if (this.importType.equals("company")) { + method = importSourceClass.getMethod("setOperateType", String.class); + method.invoke(obj, this.operateType); + } + method = importSourceClass.getMethod("valExcelData"); + try { + valErrorInfo = (String) method.invoke(obj); + } catch (Exception e) { + //验证出错返回错误信息 + params = new HashMap<>(); + params.put("pId", this.pId); + params.put("lineNum", (i + 2)); + params.put("relatedName", this.getRelatedName(obj)); + params.put("msg", importSourceName + "第" + (i + 2) + "行数据,验证失败!"); + params.put("status", "0"); + importLogService.saveImportDeitalLog(params, user); + continue; + } + if (valErrorInfo.length() == 0) { + /*如果是常用组的导入,并且导入类型是覆盖,则需要先删除原有的数据*/ + if (this.importType.equals("group") && this.operateType.equals("cover")) { + method = importSourceClass.getMethod("setOperateType", String.class); + method.invoke(obj, this.operateType); + method = importSourceClass.getMethod("getId"); + int temp = (int) method.invoke(obj); + + if (!deletedGroupId.contains(temp)) { + method = importSourceClass.getMethod("deleteOldData"); + method.invoke(obj); + + deletedGroupId.add(temp); + } + } else if (this.importType.equals("groupMember") && this.operateType.equals("cover")) { + /*如果是常用组成员的导入,并且导入类型是覆盖,则需要先删除原有的数据*/ + method = importSourceClass.getMethod("setOperateType", String.class); + method.invoke(obj, this.operateType); + if (!this.isDeleted) { + method = importSourceClass.getMethod("deleteOldData"); + method.invoke(obj); + this.isDeleted = true; + } + } + method = importSourceClass.getMethod("save"); + flag = (String) method.invoke(obj); + params = new HashMap<>(); + params.put("pId", this.pId); + params.put("lineNum", (i + 2)); + params.put("relatedName", this.getRelatedName(obj)); + String msg = importSourceName + "第" + (i + 2) + "行数据," + this.getRelatedName(obj); + if (this.importType.equals("company")) { + method = importSourceClass.getMethod("getMessage"); + msg += (String) method.invoke(obj); + } + params.put("msg", flag.equals("true") ? msg + "导入成功" : msg + "导入失败"); + params.put("status", flag.equals("true") ? "1" : "0"); + importLogService.saveImportDeitalLog(params, user); + } else { + //验证出错返回错误信息 + params = new HashMap<>(); + params.put("pId", this.pId); + params.put("lineNum", (i + 2)); + params.put("relatedName", this.getRelatedName(obj)); + params.put("msg", importSourceName + "第" + (i + 2) + "行数据," + valErrorInfo); + params.put("status", "0"); + importLogService.saveImportDeitalLog(params, user); + } + } + //加载缓存 + method = importSourceClass.getMethod("removeCache"); + if (obj != null) method.invoke(obj); + + if (!this.importType.equals("resourcedetial")) { + params = new HashMap<>(); + params.put("pId", this.pId); + params.put("status", "over"); + importLogService.saveImportLogStatus(params, user); + } + } + + if (this.importType.equals("resourcedetial")) { + //导入基本信息自定义明细字段 + HrmResourceDefineDetialE9 HrmResourceDefineDetialE9 = new HrmResourceDefineDetialE9(); + HrmResourceDefineDetialE9.importXls(workbook, this.pId, user); + params = new HashMap<>(); + params.put("pId", this.pId); + params.put("status", "over"); + importLogService.saveImportLogStatus(params, user); + } + + } catch (FileNotFoundException e) { + params = new HashMap<>(); + params.put("pId", this.pId); + params.put("status", "error"); + importLogService.saveImportLogStatus(params, user); + } catch (IOException e) { + this.errorInfo.add(SystemEnv.getHtmlLabelName(83618, userLanguage)); + new BaseBean().writeLog(e); + params = new HashMap<>(); + params.put("pId", this.pId); + params.put("status", "error"); + importLogService.saveImportLogStatus(params, user); + } catch (IndexOutOfBoundsException e) { + new BaseBean().writeLog("岗位导入的报错1。。。。"); + this.errorInfo.add(SystemEnv.getHtmlLabelName(125871, userLanguage)); + new BaseBean().writeLog(e); + params = new HashMap<>(); + params.put("pId", this.pId); + params.put("status", "error"); + importLogService.saveImportLogStatus(params, user); + } catch (Exception e) { + new BaseBean().writeLog("岗位导入的报错2。。。。"); + new BaseBean().writeLog(e); + this.errorInfo.add(SystemEnv.getHtmlLabelName(125871, userLanguage)); + params = new HashMap<>(); + params.put("pId", this.pId); + params.put("status", "error"); + importLogService.saveImportLogStatus(params, user); + } + return this.errorInfo; + } + + /** + * 校验模板有效性 + * + * @param importSourceFieldName 导入文件名称 + */ + public String valExcelTemp(String importSourceFieldName) { + String valExcelTempInfo = ""; + HSSFRow row; + HSSFCell cell; + String cellValue; + try { + String[] fieldname = importSourceFieldName.split(","); + if (this.importType.equals("group")) { + if (this.keyField.equals("workcode")) { + fieldname[3] = "成员编号[必填]"; + } + } + row = sheet.getRow(0); + for (int cellIndex = 0; cellIndex < row.getLastCellNum(); cellIndex++) { + cell = row.getCell((short) cellIndex); + if (cell == null) continue; + cellValue = getCellValue(cell).trim(); + if (!fieldname[cellIndex].equals(cellValue)) { + valExcelTempInfo = SystemEnv.getHtmlLabelName(387156, user.getLanguage()); + break; + } + } + } catch (Exception e) { + new BaseBean().writeLog(e); + valExcelTempInfo = SystemEnv.getHtmlLabelName(387156, user.getLanguage()) + "1"; + } + + return valExcelTempInfo; + } + + /** + * 读excel文件内容 + */ + public void readexcel() { + try { + HSSFRow row; + HSSFCell cell; + String cellValue; + // 行号 + // 列号 + int firstRow = 1; + lsImportSourceMap.clear(); + int lastRow = sheet.getLastRowNum(); + for (int i = firstRow; i <= lastRow; i++) { + row = sheet.getRow(i); + if (row == null) { + errorInfo.add(SystemEnv.getHtmlLabelName(15323, userLanguage) + " " + (i + 1) + " " + SystemEnv.getHtmlLabelName(83622, userLanguage)); + continue; + } + + Object obj = importSourceClass.newInstance(); + for (int cellIndex = 0; cellIndex < row.getLastCellNum(); cellIndex++) { + cell = row.getCell((short) cellIndex); + if (cell == null) continue; + cellValue = getCellValue(cell).trim(); + setImportSourceValue(cellIndex, cellValue, obj, null); + } + switch (this.importType) { + case "group": + ((HrmGroup) obj).setKeyField(this.keyField); + ((HrmGroup) obj).setOwner(this.creator); + ((HrmGroup) obj).setOperateType(this.operateType); + break; + case "groupMember": + ((HrmGroupMember) obj).setKeyField(this.keyField); + break; + case "sensitiveword": + ((SensitiveWord) obj).setCreater(this.creator); + break; + } + lsImportSourceMap.add(obj); + } + } catch (Exception e) { + new BaseBean().writeLog(e); + } + } + + /** + * 获取excel单元格值 + * + * @param cell 要读取的单元格对象 + */ + public String getCellValue(HSSFCell cell) { + String cellValue = ""; + if (cell == null) + return ""; + switch (cell.getCellType()) { + case BOOLEAN: // 得到Boolean对象的方法 + cellValue = String.valueOf(cell.getBooleanCellValue()); + break; + case NUMERIC: + cellValue = getString(HSSFDateUtil.isCellDateFormatted(cell), cell.getDateCellValue(), cell.getNumericCellValue()); + break; + case FORMULA: // 读取公式 + cellValue = cell.getCellFormula(); + break; + case STRING: // 读取String + cellValue = cell.getStringCellValue(); + break; + } + cellValue = Util.toHtmlForHrm(cellValue); + return cellValue; + } + + @NotNull + public static String getString(boolean cellDateFormatted, Date dateCellValue, double numericCellValue) { + String cellValue; + if (cellDateFormatted) {// 先看是否是日期格式 + SimpleDateFormat sft = new SimpleDateFormat("yyyy-MM-dd"); + cellValue = sft.format(dateCellValue); // 读取日期格式 + } else { + cellValue = String.valueOf(new Double(numericCellValue)); // 读取数字 + if (cellValue.endsWith(".0")) + cellValue = cellValue.substring(0, cellValue.indexOf(".")); + } + return cellValue; + } + + /** + * 通过反射为对象赋值 + * + * @param cellNum 列号 + * @param cellValue 单元格值 + * @param importSourceObj 需要赋值的 + */ + public void setImportSourceValue(int cellNum, String cellValue, Object importSourceObj, String field) { + if (field == null) { + String excelField = voFields[cellNum]; + String methodName = "set" + excelField.substring(0, 1).toUpperCase() + excelField.substring(1); + Method method = parameterTypes.get(methodName); + try { + String fieldType = fieldTypes.get(excelField); + if (fieldType.equals("java.lang.String")) + method.invoke(importSourceObj, cellValue); + else if (fieldType.equals("java.lang.Integer") && !cellValue.equals("")) { + method.invoke(importSourceObj, Integer.parseInt(cellValue)); + } else if (fieldType.equals("java.lang.Float") && !cellValue.equals("")) + method.invoke(importSourceObj, Float.parseFloat(cellValue)); + else if (fieldType.equals("java.lang.Short") && !cellValue.equals("")) { + method.invoke(importSourceObj, Short.parseShort(cellValue)); + } + } catch (Exception e) { + new BaseBean().writeLog(e); + } + } else { + String methodName = "set" + field.substring(0, 1).toUpperCase() + field.substring(1); + Method method = parameterTypes.get(methodName); + try { + method.invoke(importSourceObj, cellValue); + } catch (Exception e) { + new BaseBean().writeLog(e); + } + } + } + + /** + * 初始化反射所需要的方法和字段Map,parameterTypes,fieldTypes + */ + public void initReflectParam() { + try { + parameterTypes.clear(); + fieldTypes.clear(); + Method[] hrmResourceMethods = importSourceClass.getDeclaredMethods(); + for (Method hrmResourceMethod : hrmResourceMethods) { + parameterTypes.put(hrmResourceMethod.getName(), hrmResourceMethod); + } + Field[] importSourceFields = importSourceClass.getDeclaredFields(); + for (Field importSourceField : importSourceFields) { + Class fieldTypeClass = importSourceField.getType(); + if (fieldTypeClass == Integer.TYPE) { + fieldTypeClass = Integer.class; + } + fieldTypes.put(importSourceField.getName(), fieldTypeClass.getName()); + } + } catch (Exception e) { + new BaseBean().writeLog(e); + } + } + + + private String getRelatedName(Object obj) { + String relatedName = ""; + try { + switch (this.importType) { + case "company": { + Method method = importSourceClass.getMethod("getSubcompanyname"); + relatedName = Util.null2String(method.invoke(obj)); + method = importSourceClass.getMethod("getDepartmentname"); + String departmentname = Util.null2String(method.invoke(obj)); + if (departmentname.length() > 0) { + relatedName += ">"; + } + relatedName += departmentname; + break; + } + case "loaction": { + Method method = importSourceClass.getMethod("getLocationname"); + relatedName = Util.null2String(method.invoke(obj)); + break; + } + case "jobtitle": { + Method method = importSourceClass.getMethod("setJobtitlemark"); + relatedName = Util.null2String(method.invoke(obj)); + break; + } + case "group": { + Method method = importSourceClass.getMethod("getGroupname"); + relatedName = Util.null2String(method.invoke(obj)); + break; + } + case "city": + case "special": { + Method method = importSourceClass.getMethod("getName"); + relatedName = Util.null2String(method.invoke(obj)); + break; + } + case "area": { + Method method = importSourceClass.getMethod("getCountryname"); + relatedName = Util.null2String(method.invoke(obj)); + break; + } + case "resourcedetial": { + Method method = importSourceClass.getMethod("getLastname"); + relatedName = Util.null2String(method.invoke(obj)); + break; + } + case "sensitiveword": { + Method method = importSourceClass.getMethod("getWord"); + relatedName = Util.null2String(method.invoke(obj)); + break; + } + } + + } catch (Exception e) { + new BaseBean().writeLog(e); + } + return relatedName; + } +} diff --git a/src/com/engine/organization/web/CodeSettingController.java b/src/com/engine/organization/web/CodeSettingController.java index 23413eb6..3f7c6ec0 100644 --- a/src/com/engine/organization/web/CodeSettingController.java +++ b/src/com/engine/organization/web/CodeSettingController.java @@ -42,7 +42,7 @@ public class CodeSettingController { User user = HrmUserVarify.getUser(request, response); return getCodeSettingWrapper(user).getHasRight(serialtype); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -55,7 +55,7 @@ public class CodeSettingController { User user = HrmUserVarify.getUser(request, response); return getCodeSettingWrapper(user).saveOrUpdateCodeSetting(params); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } diff --git a/src/com/engine/organization/web/CompController.java b/src/com/engine/organization/web/CompController.java index 38888e72..549789f2 100644 --- a/src/com/engine/organization/web/CompController.java +++ b/src/com/engine/organization/web/CompController.java @@ -48,7 +48,7 @@ public class CompController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getCompWrapper(user).listPage(params)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -68,7 +68,7 @@ public class CompController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getCompWrapper(user).saveBaseComp(params)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -88,7 +88,7 @@ public class CompController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getCompWrapper(user).updateForbiddenTagById(param)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -108,7 +108,7 @@ public class CompController { Map map = ParamUtil.request2Map(request); return ReturnResult.successed(getCompWrapper(user).updateComp(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -129,7 +129,7 @@ public class CompController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getCompWrapper(user).deleteByIds(param.getIds())); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -149,7 +149,7 @@ public class CompController { Map map = ParamUtil.request2Map(request); return ReturnResult.successed(getCompWrapper(user).getSearchCondition(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -168,7 +168,7 @@ public class CompController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getCompWrapper(user).getHasRight()); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -188,7 +188,7 @@ public class CompController { Map map = ParamUtil.request2Map(request); return ReturnResult.successed(getCompWrapper(user).getCompBaseForm(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -208,7 +208,7 @@ public class CompController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getCompWrapper(user).getCompSaveForm()); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -220,7 +220,7 @@ public class CompController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getCompWrapper(user).getMoveForm()); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -232,7 +232,7 @@ public class CompController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getCompWrapper(user).moveCompany(param)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } diff --git a/src/com/engine/organization/web/DemoController.java b/src/com/engine/organization/web/DemoController.java index 3a8b5d6e..e6afc822 100644 --- a/src/com/engine/organization/web/DemoController.java +++ b/src/com/engine/organization/web/DemoController.java @@ -38,7 +38,7 @@ public class DemoController { User user = HrmUserVarify.getUser(request, response); return getDemoWrapper(user).testDemo(name); }catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -58,7 +58,7 @@ public class DemoController { Demo list = testService.list(name); return ReturnResult.successed(list); }catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } diff --git a/src/com/engine/organization/web/DepartmentController.java b/src/com/engine/organization/web/DepartmentController.java index 58ee9955..7f208e57 100644 --- a/src/com/engine/organization/web/DepartmentController.java +++ b/src/com/engine/organization/web/DepartmentController.java @@ -44,7 +44,7 @@ public class DepartmentController { User user = HrmUserVarify.getUser(request, response); return getDepartmentWrapper(user).getDeptListByPid(querySingleDeptListParam); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -58,7 +58,7 @@ public class DepartmentController { String parentDept = (String) map.get("parentDept"); return ReturnResult.successed(getDepartmentWrapper(user).getJobListByPid(QuerySingleDeptListParam.builder().parentDept(Long.parseLong(parentDept)).build())); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -96,7 +96,7 @@ public class DepartmentController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getDepartmentWrapper(user).listPage(params)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -116,7 +116,7 @@ public class DepartmentController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getDepartmentWrapper(user).saveBaseForm(params)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -136,7 +136,7 @@ public class DepartmentController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getDepartmentWrapper(user).updateForbiddenTagById(param)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -156,7 +156,7 @@ public class DepartmentController { Map map = ParamUtil.request2Map(request); return ReturnResult.successed(getDepartmentWrapper(user).updateForm(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -177,7 +177,7 @@ public class DepartmentController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getDepartmentWrapper(user).deleteByIds(param.getIds())); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -197,7 +197,7 @@ public class DepartmentController { Map map = ParamUtil.request2Map(request); return ReturnResult.successed(getDepartmentWrapper(user).getSearchCondition(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -216,7 +216,7 @@ public class DepartmentController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getDepartmentWrapper(user).getHasRight()); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -236,7 +236,7 @@ public class DepartmentController { Map map = ParamUtil.request2Map(request); return ReturnResult.successed(getDepartmentWrapper(user).getDeptBaseForm(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -255,7 +255,7 @@ public class DepartmentController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getDepartmentWrapper(user).getSaveForm()); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -268,7 +268,7 @@ public class DepartmentController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getDepartmentWrapper(user).getCopyForm()); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -280,7 +280,7 @@ public class DepartmentController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getDepartmentWrapper(user).copyDepartment(copyParam)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -294,7 +294,7 @@ public class DepartmentController { String id = (String) map.get("id"); return ReturnResult.successed(getDepartmentWrapper(user).getMergeForm(Long.parseLong(id))); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -306,7 +306,7 @@ public class DepartmentController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getDepartmentWrapper(user).mergeDepartment(mergeParam)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -318,7 +318,7 @@ public class DepartmentController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getDepartmentWrapper(user).getMoveForm()); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -330,7 +330,7 @@ public class DepartmentController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getDepartmentWrapper(user).moveDepartment(moveParam)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } diff --git a/src/com/engine/organization/web/ExportCommonController.java b/src/com/engine/organization/web/ExportCommonController.java new file mode 100644 index 00000000..f189547f --- /dev/null +++ b/src/com/engine/organization/web/ExportCommonController.java @@ -0,0 +1,108 @@ +package com.engine.organization.web; + +import com.alipay.oceanbase.jdbc.StringUtils; +import com.engine.common.util.ServiceUtil; +import com.engine.organization.entity.hrmresource.param.HrmResourceSearchParam; +import com.engine.organization.wrapper.ExportCommonWrapper; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import weaver.hrm.HrmUserVarify; +import weaver.hrm.User; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.StreamingOutput; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @Author weaver_cl + * @Description: + * @Date 2022/6/28 + * @Version V1.0 + **/ +public class ExportCommonController { + + private ExportCommonWrapper getExportCommonWrapper(User user) { + return ServiceUtil.getService(ExportCommonWrapper.class,user); + } + + @GET + @Path("/resource/export") + @Produces(MediaType.APPLICATION_OCTET_STREAM) + public Response resourceExport(@Context HttpServletRequest request, @Context HttpServletResponse response, + @QueryParam("ids") String ids) { + //HrmResourceSearchParam param = buildResourceParam(request); + List idList = new ArrayList<>(); + if (StringUtils.isNotBlank(ids)){ + idList = Arrays.stream(ids.split(",")).map(Long::parseLong).collect(Collectors.toList()); + } + User user = HrmUserVarify.getUser(request, response); + XSSFWorkbook workbook = getExportCommonWrapper(user).resourceExport(idList); + String time = LocalDate.now().toString(); + String fileName = "人员导出" + time; + try { + fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + StreamingOutput output = outputStream -> { + workbook.write(outputStream); + outputStream.flush(); + }; + response.setContentType("application/octet-stream"); + return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build(); + } + + + + private HrmResourceSearchParam buildResourceParam(HttpServletRequest request) { + HrmResourceSearchParam param = new HrmResourceSearchParam(); + String lastName = request.getParameter("lastName"); + if (StringUtils.isNotBlank(lastName)){ + param.setLastName(lastName); + } + String managerId = request.getParameter("managerId"); + if (StringUtils.isNotBlank(managerId)){ + param.setManagerId(Long.valueOf(managerId)); + } + String companyId = request.getParameter("companyId"); + if (StringUtils.isNotBlank(companyId)){ + param.setCompanyId(Long.valueOf(companyId)); + } + String departmentId = request.getParameter("departmentId"); + if (StringUtils.isNotBlank(departmentId)){ + param.setDepartmentId(Long.valueOf(departmentId)); + } + String mobile = request.getParameter("mobile"); + if (StringUtils.isNotBlank(mobile)){ + param.setMobile(mobile); + } + String telephone = request.getParameter("telephone"); + if (StringUtils.isNotBlank(telephone)){ + param.setTelephone(telephone); + } + String mobileCall = request.getParameter("mobileCall"); + if (StringUtils.isNotBlank(mobileCall)){ + param.setMobileCall(mobileCall); + } + String jobTitle = request.getParameter("jobTitle"); + if (StringUtils.isNotBlank(jobTitle)){ + param.setJobTitle(Long.valueOf(jobTitle)); + } + return param; + } + + +} diff --git a/src/com/engine/organization/web/FieldDefinedController.java b/src/com/engine/organization/web/FieldDefinedController.java index d569a9b3..c791d24f 100644 --- a/src/com/engine/organization/web/FieldDefinedController.java +++ b/src/com/engine/organization/web/FieldDefinedController.java @@ -41,7 +41,7 @@ public class FieldDefinedController { User user = HrmUserVarify.getUser(request, response); return getFieldDefinedWrapper(user).getTree(moduleTypeEnum); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -54,7 +54,7 @@ public class FieldDefinedController { User user = HrmUserVarify.getUser(request, response); return getFieldDefinedWrapper(user).saveTree(moduleTypeEnum, fieldTypeTreeParam); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -67,7 +67,7 @@ public class FieldDefinedController { User user = HrmUserVarify.getUser(request, response); return getFieldDefinedWrapper(user).changeTree(moduleTypeEnum, fieldTypeTreeParam); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -80,7 +80,7 @@ public class FieldDefinedController { User user = HrmUserVarify.getUser(request, response); return getFieldDefinedWrapper(user).deleteTree(fieldTypeTreeParam.getId()); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -95,7 +95,7 @@ public class FieldDefinedController { String groupType = (String) map.get("groupType"); return ReturnResult.successed(getFieldDefinedWrapper(user).getTabInfo(groupType)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -115,7 +115,7 @@ public class FieldDefinedController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getFieldDefinedWrapper(user).saveGroup(param)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -135,7 +135,7 @@ public class FieldDefinedController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getFieldDefinedWrapper(user).saveTitle(param)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -147,7 +147,7 @@ public class FieldDefinedController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getFieldDefinedWrapper(user).deleteTitle(param)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -159,7 +159,7 @@ public class FieldDefinedController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getFieldDefinedWrapper(user).saveFields(param.getData())); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -174,7 +174,7 @@ public class FieldDefinedController { Long groupId = Long.parseLong((String) map.get("groupId")); return ReturnResult.successed(getFieldDefinedWrapper(user).getFieldDefinedInfo(ExtendFieldSearchParam.builder().groupType(groupType).groupId(groupId).build())); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -187,7 +187,7 @@ public class FieldDefinedController { getFieldDefinedWrapper(user).deleteFieldDefined(param); return ReturnResult.successed(); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -200,7 +200,7 @@ public class FieldDefinedController { getFieldDefinedWrapper(user).changeGroup(param); return ReturnResult.successed(); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } } diff --git a/src/com/engine/organization/web/GradeController.java b/src/com/engine/organization/web/GradeController.java index 55bce20d..f0a7f34b 100644 --- a/src/com/engine/organization/web/GradeController.java +++ b/src/com/engine/organization/web/GradeController.java @@ -27,6 +27,8 @@ import java.util.Map; * @version: 1.0 */ public class GradeController { + + public GradeWrapper getGradeWrapper(User user) { return ServiceUtil.getService(GradeWrapper.class, user); } @@ -47,7 +49,7 @@ public class GradeController { Map map = ParamUtil.request2Map(request); return ReturnResult.successed(getGradeWrapper(user).listPage(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -66,7 +68,7 @@ public class GradeController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getGradeWrapper(user).saveGrade(param)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -86,7 +88,7 @@ public class GradeController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getGradeWrapper(user).updateGrade(param)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -106,7 +108,7 @@ public class GradeController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getGradeWrapper(user).updateForbiddenTagById(param)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -127,7 +129,7 @@ public class GradeController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getGradeWrapper(user).deleteByIds(param.getIds())); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -147,7 +149,7 @@ public class GradeController { Map map = ParamUtil.request2Map(request); return ReturnResult.successed(getGradeWrapper(user).getSearchCondition(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -166,9 +168,10 @@ public class GradeController { try { User user = HrmUserVarify.getUser(request, response); Map map = ParamUtil.request2Map(request); + //String s = Util.null2String(map.get(ParamConstant.PARAM_IP)); return ReturnResult.successed(getGradeWrapper(user).getGradeForm(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -187,7 +190,7 @@ public class GradeController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getGradeWrapper(user).getHasRight()); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -199,7 +202,7 @@ public class GradeController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getGradeWrapper(user).getTabInfo()); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } } diff --git a/src/com/engine/organization/web/GroupController.java b/src/com/engine/organization/web/GroupController.java index 674dfe4b..d8ce86fc 100644 --- a/src/com/engine/organization/web/GroupController.java +++ b/src/com/engine/organization/web/GroupController.java @@ -45,7 +45,7 @@ public class GroupController { Map map = ParamUtil.request2Map(request); return ReturnResult.successed(getGroupWrapper(user).getGroupFormField(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -57,7 +57,7 @@ public class GroupController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getGroupWrapper(user).updateGroup(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -76,7 +76,7 @@ public class GroupController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getGroupWrapper(user).getHasRight()); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -88,7 +88,7 @@ public class GroupController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getGroupWrapper(user).getTabInfo()); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } } diff --git a/src/com/engine/organization/web/HrmResourceController.java b/src/com/engine/organization/web/HrmResourceController.java index b3c5e9ac..c9d101fd 100644 --- a/src/com/engine/organization/web/HrmResourceController.java +++ b/src/com/engine/organization/web/HrmResourceController.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.engine.common.util.ParamUtil; import com.engine.common.util.ServiceUtil; +import com.engine.organization.entity.hrmresource.param.HrmRelationSaveParam; import com.engine.organization.entity.hrmresource.param.HrmResourceSearchParam; import com.engine.organization.entity.searchtree.SearchTreeParams; import com.engine.organization.util.response.ReturnResult; @@ -67,7 +68,7 @@ public class HrmResourceController { HrmResourceSearchParam param = JSONObject.toJavaObject((JSON) JSONObject.toJSON(map), HrmResourceSearchParam.class); return ReturnResult.successed(getHrmResourceWrapper(user).listPage(param)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -86,7 +87,7 @@ public class HrmResourceController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getHrmResourceWrapper(user).getSaveForm()); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -105,7 +106,7 @@ public class HrmResourceController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getHrmResourceWrapper(user).saveBaseForm(params)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -125,7 +126,7 @@ public class HrmResourceController { Map map = ParamUtil.request2Map(request); return ReturnResult.successed(getHrmResourceWrapper(user).getBaseForm(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -145,7 +146,7 @@ public class HrmResourceController { Map map = ParamUtil.request2Map(request); return ReturnResult.successed(getHrmResourceWrapper(user).updateForm(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -165,7 +166,7 @@ public class HrmResourceController { Map map = ParamUtil.request2Map(request); return ReturnResult.successed(getHrmResourceWrapper(user).getSearchCondition(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -184,7 +185,44 @@ public class HrmResourceController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getHrmResourceWrapper(user).getHasRight()); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); + } + } + + @GET + @Path("/getTabForm") + @Produces(MediaType.APPLICATION_JSON) + public ReturnResult getTabForm(@Context HttpServletRequest request, @Context HttpServletResponse response) { + try { + User user = HrmUserVarify.getUser(request, response); + Map map = ParamUtil.request2Map(request); + return ReturnResult.successed(getHrmResourceWrapper(user).getTabForm(map)); + } catch (Exception e) { + return ReturnResult.exceptionHandle(e); + } + } + + @POST + @Path("/saveTabForm") + @Produces(MediaType.APPLICATION_JSON) + public ReturnResult saveTabForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody HrmRelationSaveParam params) { + try { + User user = HrmUserVarify.getUser(request, response); + return ReturnResult.successed(getHrmResourceWrapper(user).saveTabForm(params)); + } catch (Exception e) { + return ReturnResult.exceptionHandle(e); + } + } + + @POST + @Path("/updateTabForm") + @Produces(MediaType.APPLICATION_JSON) + public ReturnResult updateTabForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody HrmRelationSaveParam params) { + try { + User user = HrmUserVarify.getUser(request, response); + return ReturnResult.successed(getHrmResourceWrapper(user).updateTabForm(params)); + } catch (Exception e) { + return ReturnResult.exceptionHandle(e); } } } diff --git a/src/com/engine/organization/web/ImportCommonController.java b/src/com/engine/organization/web/ImportCommonController.java new file mode 100644 index 00000000..4a9a6195 --- /dev/null +++ b/src/com/engine/organization/web/ImportCommonController.java @@ -0,0 +1,42 @@ +package com.engine.organization.web; + +import com.engine.common.util.ParamUtil; +import com.engine.common.util.ServiceUtil; +import com.engine.organization.util.response.ReturnResult; +import com.engine.organization.wrapper.ImportCommonWrapper; +import weaver.hrm.HrmUserVarify; +import weaver.hrm.User; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import java.util.Map; + +/** + * @author:dxfeng + * @createTime: 2022/06/29 + * @version: 1.0 + */ +public class ImportCommonController { + + private ImportCommonWrapper getImportCommonWrapper(User user) { + return ServiceUtil.getService(ImportCommonWrapper.class, user); + } + + @POST + @Path("/saveImportResource") + @Produces(MediaType.APPLICATION_JSON) + public ReturnResult saveImportResource(@Context HttpServletRequest request, @Context HttpServletResponse response) { + try { + User user = HrmUserVarify.getUser(request, response); + Map map = ParamUtil.request2Map(request); + return ReturnResult.successed(getImportCommonWrapper(user).saveImportResource(map, request)); + } catch (Exception e) { + return ReturnResult.exceptionHandle(e); + } + } +} diff --git a/src/com/engine/organization/web/JobController.java b/src/com/engine/organization/web/JobController.java index 3da91b88..9e93de61 100644 --- a/src/com/engine/organization/web/JobController.java +++ b/src/com/engine/organization/web/JobController.java @@ -67,7 +67,7 @@ public class JobController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getJobWrapper(user).listPage(params)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -86,7 +86,7 @@ public class JobController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getJobWrapper(user).getSaveForm()); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -106,7 +106,7 @@ public class JobController { Map map = ParamUtil.request2Map(request); return ReturnResult.successed(getJobWrapper(user).getJobBaseForm(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -126,7 +126,7 @@ public class JobController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getJobWrapper(user).saveBaseForm(params)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -146,7 +146,7 @@ public class JobController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getJobWrapper(user).updateForbiddenTagById(param)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -166,7 +166,7 @@ public class JobController { Map map = ParamUtil.request2Map(request); return ReturnResult.successed(getJobWrapper(user).updateForm(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -184,9 +184,9 @@ public class JobController { public ReturnResult copyJobItem(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody JobCopyParam param) { try { User user = HrmUserVarify.getUser(request, response); - return ReturnResult.successed(getJobWrapper(user).copyJobItem(param.getIds(), param.getDepartment())); + return ReturnResult.successed(getJobWrapper(user).copyJobItem(param)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -206,7 +206,7 @@ public class JobController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getJobWrapper(user).deleteByIds(param.getIds())); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -225,7 +225,7 @@ public class JobController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getJobWrapper(user).getHasRight()); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -244,7 +244,7 @@ public class JobController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getJobWrapper(user).getSearchCondition()); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -257,7 +257,7 @@ public class JobController { User user = HrmUserVarify.getUser(request, response); return getJobWrapper(user).getCopyForm(); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -271,7 +271,7 @@ public class JobController { User user = HrmUserVarify.getUser(request, response); return getJobWrapper(user).getHrmListByJobId(jobId); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -283,7 +283,7 @@ public class JobController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getJobWrapper(user).getMergeForm()); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -295,7 +295,7 @@ public class JobController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getJobWrapper(user).mergeJob(param)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } diff --git a/src/com/engine/organization/web/LevelController.java b/src/com/engine/organization/web/LevelController.java index 2f9157aa..ed3aea62 100644 --- a/src/com/engine/organization/web/LevelController.java +++ b/src/com/engine/organization/web/LevelController.java @@ -47,7 +47,7 @@ public class LevelController { Map map = ParamUtil.request2Map(request); return ReturnResult.successed(getLevelWrapper(user).listPage(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -66,7 +66,7 @@ public class LevelController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getLevelWrapper(user).saveLevel(param)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -86,7 +86,7 @@ public class LevelController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getLevelWrapper(user).updateLevel(param)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -106,7 +106,7 @@ public class LevelController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getLevelWrapper(user).updateForbiddenTagById(param)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -127,7 +127,7 @@ public class LevelController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getLevelWrapper(user).deleteByIds(param.getIds())); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -147,7 +147,7 @@ public class LevelController { Map map = ParamUtil.request2Map(request); return ReturnResult.successed(getLevelWrapper(user).getSearchCondition(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -168,7 +168,7 @@ public class LevelController { Map map = ParamUtil.request2Map(request); return ReturnResult.successed(getLevelWrapper(user).getLevelForm(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -187,7 +187,7 @@ public class LevelController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getLevelWrapper(user).getTableBtn()); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -199,7 +199,7 @@ public class LevelController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getLevelWrapper(user).getTabInfo()); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -211,7 +211,7 @@ public class LevelController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getLevelWrapper(user).getTreeData()); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } } diff --git a/src/com/engine/organization/web/LogViewController.java b/src/com/engine/organization/web/LogViewController.java new file mode 100644 index 00000000..51eae87f --- /dev/null +++ b/src/com/engine/organization/web/LogViewController.java @@ -0,0 +1,59 @@ +package com.engine.organization.web; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.engine.common.util.ParamUtil; +import com.engine.common.util.ServiceUtil; +import com.engine.organization.entity.logview.param.LogViewSearchParam; +import com.engine.organization.util.response.ReturnResult; +import com.engine.organization.wrapper.LogViewWrapper; +import weaver.hrm.HrmUserVarify; +import weaver.hrm.User; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import java.util.Map; + +/** + * @author:dxfeng + * @createTime: 2022/07/05 + * @version: 1.0 + */ +public class LogViewController { + public LogViewWrapper getLogViewWrapper(User user) { + return ServiceUtil.getService(LogViewWrapper.class, user); + } + + + @GET + @Path("/listPage") + @Produces(MediaType.APPLICATION_JSON) + public ReturnResult listPage(@Context HttpServletRequest request, @Context HttpServletResponse response) { + try { + User user = HrmUserVarify.getUser(request, response); + Map map = ParamUtil.request2Map(request); + LogViewSearchParam params = JSONObject.toJavaObject((JSON) JSON.toJSON(map), LogViewSearchParam.class); + return ReturnResult.successed(getLogViewWrapper(user).listPage(params)); + } catch (Exception e) { + return ReturnResult.exceptionHandle(e); + } + } + + + @GET + @Path("/getSearchCondition") + @Produces(MediaType.APPLICATION_JSON) + public ReturnResult getSearchCondition(@Context HttpServletRequest request, @Context HttpServletResponse response) { + try { + User user = HrmUserVarify.getUser(request, response); + return ReturnResult.successed(getLogViewWrapper(user).getSearchCondition()); + } catch (Exception e) { + return ReturnResult.exceptionHandle(e); + } + } +} diff --git a/src/com/engine/organization/web/OrgChartController.java b/src/com/engine/organization/web/OrgChartController.java new file mode 100644 index 00000000..78c327be --- /dev/null +++ b/src/com/engine/organization/web/OrgChartController.java @@ -0,0 +1,100 @@ +package com.engine.organization.web; + +import com.alibaba.fastjson.JSONObject; +import com.engine.common.util.ParamUtil; +import com.engine.common.util.ServiceUtil; +import com.engine.organization.wrapper.OrgChartWrapper; +import weaver.hrm.HrmUserVarify; +import weaver.hrm.User; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import java.util.HashMap; +import java.util.Map; + +/** + * @className: OrgChartController + * @author: dengjp + * @date: 2022/7/7 + * @description: 组织架构图 + **/ +public class OrgChartController { + public OrgChartWrapper getOrgChartWrapper(User user) { + return ServiceUtil.getService(OrgChartWrapper.class, user); + } + + /** + * 获取组织维度信息 + * */ + @GET + @Path("/getCondition") + @Produces(MediaType.APPLICATION_JSON) + public String getCondition(@Context HttpServletRequest request, @Context HttpServletResponse + response){ + Map apidatas = new HashMap(); + try{ + User user = HrmUserVarify.getUser(request, response); + //实例化Service 并调用业务类处理 + apidatas = getOrgChartWrapper(user).getOptionCondition(ParamUtil.request2Map(request), user); + }catch(Exception e){ + //异常处理 + e.printStackTrace(); + apidatas.put("api_status", false); + apidatas.put("api_errormsg", "catch exception : " + e.getMessage()); + } + //数据转换 + return JSONObject.toJSONString(apidatas); + } + + /** + * 组织架构数据 + * */ + @GET + @Path("/companyData") + @Produces(MediaType.APPLICATION_JSON) + public String getCompanyData(@Context HttpServletRequest request, @Context HttpServletResponse + response){ + Map apidatas = new HashMap(); + try{ + User user = HrmUserVarify.getUser(request, response); + //实例化Service 并调用业务类处理 + apidatas = getOrgChartWrapper(user).getCompanyData(ParamUtil.request2Map(request), user); + }catch(Exception e){ + //异常处理 + e.printStackTrace(); + apidatas.put("api_status", false); + apidatas.put("api_errormsg", "catch exception : " + e.getMessage()); + } + //数据转换 + return JSONObject.toJSONString(apidatas); + } + + /** + * 组织透视图 + * */ + @GET + @Path("/userData") + @Produces(MediaType.APPLICATION_JSON) + public String getUserData(@Context HttpServletRequest request, @Context HttpServletResponse + response){ + Map apidatas = new HashMap(); + try{ + User user = HrmUserVarify.getUser(request, response); + //实例化Service 并调用业务类处理 + apidatas = getOrgChartWrapper(user).getUserData(ParamUtil.request2Map(request), user); + }catch(Exception e){ + //异常处理 + e.printStackTrace(); + apidatas.put("api_status", false); + apidatas.put("api_errormsg", "catch exception : " + e.getMessage()); + } + //数据转换 + return JSONObject.toJSONString(apidatas); + } + +} diff --git a/src/com/engine/organization/web/PostController.java b/src/com/engine/organization/web/PostController.java index f5e15d43..8abb43ea 100644 --- a/src/com/engine/organization/web/PostController.java +++ b/src/com/engine/organization/web/PostController.java @@ -48,7 +48,7 @@ public class PostController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getPostWrapper(user).savePost(postPO)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -68,7 +68,7 @@ public class PostController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getPostWrapper(user).updatePost(postPO)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -89,7 +89,7 @@ public class PostController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getPostWrapper(user).deleteByIds(param.getIds())); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -110,7 +110,7 @@ public class PostController { Map map = ParamUtil.request2Map(request); return ReturnResult.successed(getPostWrapper(user).getPostForm(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -128,7 +128,7 @@ public class PostController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getPostWrapper(user).getTreeData()); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } diff --git a/src/com/engine/organization/web/PostInfoController.java b/src/com/engine/organization/web/PostInfoController.java index a3e0ca70..a9f0a852 100644 --- a/src/com/engine/organization/web/PostInfoController.java +++ b/src/com/engine/organization/web/PostInfoController.java @@ -47,7 +47,7 @@ public class PostInfoController { Map map = ParamUtil.request2Map(request); return ReturnResult.successed(getPostInfoWrapper(user).listPage(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -66,7 +66,7 @@ public class PostInfoController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getPostInfoWrapper(user).savePostInfo(param)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -86,7 +86,7 @@ public class PostInfoController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getPostInfoWrapper(user).updatePostInfo(param)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -106,7 +106,7 @@ public class PostInfoController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getPostInfoWrapper(user).updateForbiddenTagById(param)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -127,7 +127,7 @@ public class PostInfoController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getPostInfoWrapper(user).deleteByIds(param.getIds())); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -147,7 +147,7 @@ public class PostInfoController { Map map = ParamUtil.request2Map(request); return ReturnResult.successed(getPostInfoWrapper(user).getSearchCondition(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -168,7 +168,7 @@ public class PostInfoController { Map map = ParamUtil.request2Map(request); return ReturnResult.successed(getPostInfoWrapper(user).getPostInfoForm(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -187,7 +187,7 @@ public class PostInfoController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getPostInfoWrapper(user).getHasRight()); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } diff --git a/src/com/engine/organization/web/SchemeController.java b/src/com/engine/organization/web/SchemeController.java index b8c23fd2..d91eb655 100644 --- a/src/com/engine/organization/web/SchemeController.java +++ b/src/com/engine/organization/web/SchemeController.java @@ -49,7 +49,7 @@ public class SchemeController { Map map = ParamUtil.request2Map(request); return ReturnResult.successed(getSchemeWrapper(user).listPage(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -66,10 +66,9 @@ public class SchemeController { public ReturnResult saveScheme(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SchemeSearchParam param) { try { User user = HrmUserVarify.getUser(request, response); - Map save = getSchemeWrapper(user).save(param); - return ReturnResult.successed(save); + return ReturnResult.successed(getSchemeWrapper(user).save(param)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -87,10 +86,9 @@ public class SchemeController { public ReturnResult updateScheme(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SchemeSearchParam param) { try { User user = HrmUserVarify.getUser(request, response); - Map update = getSchemeWrapper(user).updateScheme(param); - return ReturnResult.successed(update); + return ReturnResult.successed(getSchemeWrapper(user).updateScheme(param)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -109,10 +107,9 @@ public class SchemeController { public ReturnResult updateForbiddenTagById(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SchemeSearchParam param) { try { User user = HrmUserVarify.getUser(request, response); - getSchemeWrapper(user).updateForbiddenTagById(param); - return ReturnResult.successed(); + return ReturnResult.successed(getSchemeWrapper(user).updateForbiddenTagById(param)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -131,10 +128,9 @@ public class SchemeController { public ReturnResult deleteByIds(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody DeleteParam param) { try { User user = HrmUserVarify.getUser(request, response); - getSchemeWrapper(user).deleteByIds(param.getIds()); - return ReturnResult.successed(); + return ReturnResult.successed(getSchemeWrapper(user).deleteByIds(param.getIds())); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -147,7 +143,7 @@ public class SchemeController { Map map = ParamUtil.request2Map(request); return ReturnResult.successed(getSchemeWrapper(user).getSearchCondition(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -161,7 +157,7 @@ public class SchemeController { Map map = ParamUtil.request2Map(request); return ReturnResult.successed(getSchemeWrapper(user).getSchemeForm(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -173,7 +169,7 @@ public class SchemeController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getSchemeWrapper(user).getTableBtn()); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -185,7 +181,7 @@ public class SchemeController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getSchemeWrapper(user).getTreeData()); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } diff --git a/src/com/engine/organization/web/SequenceController.java b/src/com/engine/organization/web/SequenceController.java index d87116cb..b432611f 100644 --- a/src/com/engine/organization/web/SequenceController.java +++ b/src/com/engine/organization/web/SequenceController.java @@ -47,7 +47,7 @@ public class SequenceController { Map map = ParamUtil.request2Map(request); return ReturnResult.successed(getSequenceWrapper(user).listPage(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -66,7 +66,7 @@ public class SequenceController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getSequenceWrapper(user).saveSequence(param)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -86,7 +86,7 @@ public class SequenceController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getSequenceWrapper(user).updateSequence(param)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -106,7 +106,7 @@ public class SequenceController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getSequenceWrapper(user).updateForbiddenTagById(param)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -127,7 +127,7 @@ public class SequenceController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getSequenceWrapper(user).deleteByIds(param.getIds())); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -147,7 +147,7 @@ public class SequenceController { Map map = ParamUtil.request2Map(request); return ReturnResult.successed(getSequenceWrapper(user).getSearchCondition(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -168,7 +168,7 @@ public class SequenceController { Map map = ParamUtil.request2Map(request); return ReturnResult.successed(getSequenceWrapper(user).getSequenceForm(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -187,7 +187,7 @@ public class SequenceController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getSequenceWrapper(user).getHasRight()); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -199,7 +199,7 @@ public class SequenceController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getSequenceWrapper(user).getTabInfo()); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } } diff --git a/src/com/engine/organization/web/StaffController.java b/src/com/engine/organization/web/StaffController.java index bd342fdc..a14e990f 100644 --- a/src/com/engine/organization/web/StaffController.java +++ b/src/com/engine/organization/web/StaffController.java @@ -50,7 +50,7 @@ public class StaffController { StaffSearchParam param = JSONObject.toJavaObject((JSON) JSON.toJSON(map), StaffSearchParam.class); return ReturnResult.successed(getStaffWrapper(user).listPage(param)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -69,7 +69,7 @@ public class StaffController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getStaffWrapper(user).saveStaff(param)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -89,7 +89,7 @@ public class StaffController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getStaffWrapper(user).updateStaff(param)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -110,7 +110,7 @@ public class StaffController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getStaffWrapper(user).deleteByIds(param.getIds())); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -130,7 +130,7 @@ public class StaffController { Map map = ParamUtil.request2Map(request); return ReturnResult.successed(getStaffWrapper(user).getSearchCondition(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -151,7 +151,7 @@ public class StaffController { Map map = ParamUtil.request2Map(request); return ReturnResult.successed(getStaffWrapper(user).getForm(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -170,7 +170,7 @@ public class StaffController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getStaffWrapper(user).getHasRight()); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } } diff --git a/src/com/engine/organization/web/StaffPlanController.java b/src/com/engine/organization/web/StaffPlanController.java index 91463cab..4f8fde87 100644 --- a/src/com/engine/organization/web/StaffPlanController.java +++ b/src/com/engine/organization/web/StaffPlanController.java @@ -50,7 +50,7 @@ public class StaffPlanController { StaffPlanSearchParam param = JSONObject.toJavaObject((JSON) JSON.toJSON(map), StaffPlanSearchParam.class); return ReturnResult.successed(getStaffPlanWrapper(user).listPage(param)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -69,7 +69,7 @@ public class StaffPlanController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getStaffPlanWrapper(user).saveStaffPlan(param)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -89,7 +89,7 @@ public class StaffPlanController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getStaffPlanWrapper(user).updateStaffPlan(param)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -109,7 +109,7 @@ public class StaffPlanController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getStaffPlanWrapper(user).updateForbiddenTagById(param)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -130,7 +130,7 @@ public class StaffPlanController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getStaffPlanWrapper(user).deleteByIds(param.getIds())); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -150,7 +150,7 @@ public class StaffPlanController { Map map = ParamUtil.request2Map(request); return ReturnResult.successed(getStaffPlanWrapper(user).getSearchCondition(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -171,7 +171,7 @@ public class StaffPlanController { Map map = ParamUtil.request2Map(request); return ReturnResult.successed(getStaffPlanWrapper(user).getForm(map)); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } @@ -190,7 +190,7 @@ public class StaffPlanController { User user = HrmUserVarify.getUser(request, response); return ReturnResult.successed(getStaffPlanWrapper(user).getHasRight()); } catch (Exception e) { - return ReturnResult.exceptionHandle(e.getMessage()); + return ReturnResult.exceptionHandle(e); } } } diff --git a/src/com/engine/organization/wrapper/CompWrapper.java b/src/com/engine/organization/wrapper/CompWrapper.java index a3800d7f..2abff738 100644 --- a/src/com/engine/organization/wrapper/CompWrapper.java +++ b/src/com/engine/organization/wrapper/CompWrapper.java @@ -1,12 +1,19 @@ package com.engine.organization.wrapper; +import com.alibaba.fastjson.JSON; import com.api.browser.bean.SearchConditionGroup; import com.engine.common.util.ServiceUtil; -import com.engine.core.impl.Service; +import com.engine.organization.annotation.Log; import com.engine.organization.entity.company.param.CompSearchParam; +import com.engine.organization.entity.company.po.CompPO; import com.engine.organization.entity.department.param.DepartmentMoveParam; +import com.engine.organization.enums.LogModuleNameEnum; +import com.engine.organization.enums.OperateTypeEnum; +import com.engine.organization.mapper.comp.CompMapper; import com.engine.organization.service.CompService; import com.engine.organization.service.impl.CompServiceImpl; +import com.engine.organization.util.OrganizationWrapper; +import com.engine.organization.util.db.MapperProxyFactory; import weaver.hrm.User; import java.util.Collection; @@ -19,11 +26,15 @@ import java.util.Map; * @createTime: 2022/05/16 * @version: 1.0 */ -public class CompWrapper extends Service { +public class CompWrapper extends OrganizationWrapper { private CompService getCompService(User user) { return ServiceUtil.getService(CompServiceImpl.class, user); } + private CompMapper getCompMapper() { + return MapperProxyFactory.getProxy(CompMapper.class); + } + /** * 列表 * @@ -41,8 +52,12 @@ public class CompWrapper extends Service { * @param params * @return */ + @Log(operateType = OperateTypeEnum.ADD, operateDesc = "新增分部", operateModule = LogModuleNameEnum.COMPANY) public Long saveBaseComp(Map params) { - return getCompService(user).saveBaseComp(params); + Long companyId = getCompService(user).saveBaseComp(params); + writeOperateLog(new Object() { + }.getClass(), params.get("comp_name").toString(), JSON.toJSONString(params), "新增分部"); + return companyId; } /** @@ -50,8 +65,13 @@ public class CompWrapper extends Service { * * @param params */ + @Log(operateType = OperateTypeEnum.UPDATE, operateDesc = "更新分部禁用标识", operateModule = LogModuleNameEnum.COMPANY) public int updateForbiddenTagById(CompSearchParam params) { - return getCompService(user).updateForbiddenTagById(params); + CompPO compPO = getCompMapper().listById(params.getId()); + int updateForbiddenTagById = getCompService(user).updateForbiddenTagById(params); + writeOperateLog(new Object() { + }.getClass(), compPO.getCompName(), JSON.toJSONString(params), compPO, getCompMapper().listById(params.getId())); + return updateForbiddenTagById; } /** @@ -60,8 +80,14 @@ public class CompWrapper extends Service { * @param params * @return */ + @Log(operateType = OperateTypeEnum.UPDATE, operateDesc = "更新分部信息", operateModule = LogModuleNameEnum.COMPANY) public Long updateComp(Map params) { - return getCompService(user).updateComp(params); + long id = Long.parseLong(params.get("id").toString()); + CompPO compPO = getCompMapper().listById(id); + Long companyId = getCompService(user).updateComp(params); + writeOperateLog(new Object() { + }.getClass(), compPO.getCompName(), JSON.toJSONString(params), compPO, getCompMapper().listById(id)); + return companyId; } /** @@ -69,8 +95,30 @@ public class CompWrapper extends Service { * * @param ids */ + @Log(operateType = OperateTypeEnum.DELETE, operateDesc = "删除分部信息", operateModule = LogModuleNameEnum.COMPANY) public int deleteByIds(Collection ids) { - return getCompService(user).deleteByIds(ids); + List compsByIds = getCompMapper().getCompsByIds(ids); + int deleteByIds = getCompService(user).deleteByIds(ids); + for (CompPO compsById : compsByIds) { + writeOperateLog(new Object() { + }.getClass(), compsById.getCompName(), JSON.toJSONString(ids), "删除分部信息"); + } + return deleteByIds; + } + + /** + * 转移分部 + * + * @param moveParam + * @return + */ + @Log(operateType = OperateTypeEnum.MOVE, operateDesc = "转移分部", operateModule = LogModuleNameEnum.COMPANY) + public int moveCompany(DepartmentMoveParam moveParam) { + CompPO compPO = getCompMapper().listById(moveParam.getId()); + int moveCompany = getCompService(user).moveCompany(moveParam); + writeOperateLog(new Object() { + }.getClass(), compPO.getCompName(), JSON.toJSONString(moveParam), compPO, getCompMapper().listById(moveParam.getId())); + return moveCompany; } /** @@ -112,15 +160,10 @@ public class CompWrapper extends Service { } /** - * 转移分部 + * 获取转移表单 * - * @param moveParam * @return */ - public int moveCompany(DepartmentMoveParam moveParam) { - return getCompService(user).moveCompany(moveParam); - } - public List getMoveForm() { return getCompService(user).getMoveForm(); } diff --git a/src/com/engine/organization/wrapper/DemoWrapper.java b/src/com/engine/organization/wrapper/DemoWrapper.java index d2a6a32e..02116e50 100644 --- a/src/com/engine/organization/wrapper/DemoWrapper.java +++ b/src/com/engine/organization/wrapper/DemoWrapper.java @@ -1,10 +1,12 @@ package com.engine.organization.wrapper; import com.engine.common.util.ServiceUtil; -import com.engine.core.impl.Service; +import com.engine.organization.annotation.Log; import com.engine.organization.entity.po.Demo; +import com.engine.organization.enums.OperateTypeEnum; import com.engine.organization.service.DemoService; import com.engine.organization.service.impl.DemoServiceImpl; +import com.engine.organization.util.OrganizationWrapper; import com.engine.organization.util.response.ReturnResult; import weaver.hrm.User; @@ -16,14 +18,16 @@ import java.util.List; * @Date 2022/4/26 * @Version V1.0 **/ -public class DemoWrapper extends Service { +public class DemoWrapper extends OrganizationWrapper { private DemoService getDemoService(User user) { - return ServiceUtil.getService(DemoServiceImpl.class,user); + return ServiceUtil.getService(DemoServiceImpl.class, user); } + @Log(operateType = OperateTypeEnum.DELETE, operateDesc = "operateDesc") public ReturnResult testDemo(String name) { List list = getDemoService(user).list(name); - return ReturnResult.successed(list); + //writeOperateLog(new Object(){}.getClass(), "记录testDemo操作日志"); + return ReturnResult.successed(list); } } diff --git a/src/com/engine/organization/wrapper/DepartmentWrapper.java b/src/com/engine/organization/wrapper/DepartmentWrapper.java index 0a6cb835..904a5a09 100644 --- a/src/com/engine/organization/wrapper/DepartmentWrapper.java +++ b/src/com/engine/organization/wrapper/DepartmentWrapper.java @@ -1,14 +1,22 @@ package com.engine.organization.wrapper; +import com.alibaba.fastjson.JSON; import com.api.browser.bean.SearchConditionGroup; import com.engine.common.util.ServiceUtil; -import com.engine.core.impl.Service; +import com.engine.organization.annotation.Log; +import com.engine.organization.entity.DeleteParam; import com.engine.organization.entity.department.param.*; +import com.engine.organization.entity.department.po.DepartmentPO; import com.engine.organization.entity.department.vo.SingleDeptTreeVO; import com.engine.organization.entity.job.vo.SingleJobTreeVO; import com.engine.organization.entity.searchtree.SearchTreeParams; +import com.engine.organization.enums.LogModuleNameEnum; +import com.engine.organization.enums.OperateTypeEnum; +import com.engine.organization.mapper.department.DepartmentMapper; import com.engine.organization.service.DepartmentService; import com.engine.organization.service.impl.DepartmentServiceImpl; +import com.engine.organization.util.OrganizationWrapper; +import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.page.PageInfo; import com.engine.organization.util.response.ReturnResult; import weaver.hrm.User; @@ -23,12 +31,16 @@ import java.util.Map; * @Date 2022/5/20 * @Version V1.0 **/ -public class DepartmentWrapper extends Service { +public class DepartmentWrapper extends OrganizationWrapper { public DepartmentService getDepartmentService(User user) { return ServiceUtil.getService(DepartmentServiceImpl.class, user); } + private DepartmentMapper getDepartmentMapper() { + return MapperProxyFactory.getProxy(DepartmentMapper.class); + } + public ReturnResult getDeptListByPid(QuerySingleDeptListParam param) { PageInfo singleDeptTreeVOS = getDepartmentService(user).getDeptListByPid(param); return ReturnResult.successed(singleDeptTreeVOS); @@ -79,8 +91,12 @@ public class DepartmentWrapper extends Service { * @param params * @return */ + @Log(operateType = OperateTypeEnum.ADD, operateDesc = "新增部门", operateModule = LogModuleNameEnum.DEPARTMENT) public Long saveBaseForm(Map params) { - return getDepartmentService(user).saveBaseForm(params); + Long departmentId = getDepartmentService(user).saveBaseForm(params); + writeOperateLog(new Object() { + }.getClass(), params.get("dept_name").toString(), JSON.toJSONString(params), "新增部门"); + return departmentId; } @@ -89,8 +105,13 @@ public class DepartmentWrapper extends Service { * * @param params */ + @Log(operateType = OperateTypeEnum.UPDATE, operateDesc = "更新部门禁用标记", operateModule = LogModuleNameEnum.DEPARTMENT) public int updateForbiddenTagById(DeptSearchParam params) { - return getDepartmentService(user).updateForbiddenTagById(params); + DepartmentPO deptById = getDepartmentMapper().getDeptById(params.getId()); + int updateForbiddenTagById = getDepartmentService(user).updateForbiddenTagById(params); + writeOperateLog(new Object() { + }.getClass(), deptById.getDeptName(), JSON.toJSONString(params), deptById, getDepartmentMapper().getDeptById(params.getId())); + return updateForbiddenTagById; } /** @@ -99,8 +120,14 @@ public class DepartmentWrapper extends Service { * @param params * @return */ + @Log(operateType = OperateTypeEnum.UPDATE, operateDesc = "更新部门", operateModule = LogModuleNameEnum.DEPARTMENT) public Long updateForm(Map params) { - return getDepartmentService(user).updateForm(params); + long id = Long.parseLong(params.get("id").toString()); + DepartmentPO deptById = getDepartmentMapper().getDeptById(id); + Long departmentId = getDepartmentService(user).updateForm(params); + writeOperateLog(new Object() { + }.getClass(), deptById.getDeptName(), JSON.toJSONString(params), deptById, getDepartmentMapper().getDeptById(id)); + return departmentId; } /** @@ -108,8 +135,15 @@ public class DepartmentWrapper extends Service { * * @param ids */ + @Log(operateType = OperateTypeEnum.DELETE, operateDesc = "删除部门", operateModule = LogModuleNameEnum.DEPARTMENT) public int deleteByIds(Collection ids) { - return getDepartmentService(user).deleteByIds(ids); + List departmentPOS = getDepartmentMapper().getDeptsByIds(ids); + int deleteByIds = getDepartmentService(user).deleteByIds(ids); + for (DepartmentPO departmentPO : departmentPOS) { + writeOperateLog(new Object() { + }.getClass(), departmentPO.getDeptName(), JSON.toJSONString(ids), "删除部门"); + } + return deleteByIds; } /** @@ -156,8 +190,15 @@ public class DepartmentWrapper extends Service { * @param copyParam * @return */ + @Log(operateType = OperateTypeEnum.COPY, operateDesc = "复制部门", operateModule = LogModuleNameEnum.DEPARTMENT) public int copyDepartment(DeptCopyParam copyParam) { - return getDepartmentService(user).copyDepartment(copyParam); + List departmentPOS = getDepartmentMapper().getDeptsByIds(DeleteParam.builder().ids(copyParam.getIds()).build().getIds()); + int copyDepartment = getDepartmentService(user).copyDepartment(copyParam); + for (DepartmentPO departmentPO : departmentPOS) { + writeOperateLog(new Object() { + }.getClass(), departmentPO.getDeptName(), JSON.toJSONString(copyParam), "复制部门[" + departmentPO.getDeptName() + "]"); + } + return copyDepartment; } /** @@ -176,8 +217,13 @@ public class DepartmentWrapper extends Service { * @param mergeParam * @return */ + @Log(operateType = OperateTypeEnum.MERGE, operateDesc = "合并部门", operateModule = LogModuleNameEnum.DEPARTMENT) public int mergeDepartment(DepartmentMergeParam mergeParam) { - return getDepartmentService(user).mergeDepartment(mergeParam); + DepartmentPO departmentPO = getDepartmentMapper().getDeptById(mergeParam.getId()); + int mergeDepartment = getDepartmentService(user).mergeDepartment(mergeParam); + writeOperateLog(new Object() { + }.getClass(), departmentPO.getDeptName(), JSON.toJSONString(mergeParam), departmentPO, getDepartmentMapper().getDeptById(departmentPO.getId())); + return mergeDepartment; } /** @@ -195,7 +241,12 @@ public class DepartmentWrapper extends Service { * @param moveParam * @return */ + @Log(operateType = OperateTypeEnum.MOVE, operateDesc = "转移部门", operateModule = LogModuleNameEnum.DEPARTMENT) public int moveDepartment(DepartmentMoveParam moveParam) { - return getDepartmentService(user).moveDepartment(moveParam); + DepartmentPO departmentPO = getDepartmentMapper().getDeptById(moveParam.getId()); + int moveDepartment = getDepartmentService(user).moveDepartment(moveParam); + writeOperateLog(new Object() { + }.getClass(), departmentPO.getDeptName(), JSON.toJSONString(moveParam), departmentPO, getDepartmentMapper().getDeptById(departmentPO.getId())); + return moveDepartment; } } diff --git a/src/com/engine/organization/wrapper/ExportCommonWrapper.java b/src/com/engine/organization/wrapper/ExportCommonWrapper.java new file mode 100644 index 00000000..0b40c757 --- /dev/null +++ b/src/com/engine/organization/wrapper/ExportCommonWrapper.java @@ -0,0 +1,27 @@ +package com.engine.organization.wrapper; + +import com.engine.common.util.ServiceUtil; +import com.engine.core.impl.Service; +import com.engine.organization.service.ExportCommonService; +import com.engine.organization.service.impl.ExportCommonServiceImpl; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import weaver.hrm.User; + +import java.util.List; + +/** + * @Author weaver_cl + * @Description: + * @Date 2022/6/28 + * @Version V1.0 + **/ +public class ExportCommonWrapper extends Service { + + public ExportCommonService getExportCommonService(User user) { + return ServiceUtil.getService(ExportCommonServiceImpl.class,user); + } + + public XSSFWorkbook resourceExport(List ids) { + return getExportCommonService(user).resourceExport(ids); + } +} diff --git a/src/com/engine/organization/wrapper/GradeWrapper.java b/src/com/engine/organization/wrapper/GradeWrapper.java index 3eaf1216..0cf8583b 100644 --- a/src/com/engine/organization/wrapper/GradeWrapper.java +++ b/src/com/engine/organization/wrapper/GradeWrapper.java @@ -1,14 +1,22 @@ package com.engine.organization.wrapper; + +import com.alibaba.fastjson.JSON; import com.engine.common.util.ServiceUtil; -import com.engine.core.impl.Service; +import com.engine.organization.annotation.Log; import com.engine.organization.entity.scheme.param.GradeSearchParam; +import com.engine.organization.entity.scheme.po.GradePO; +import com.engine.organization.enums.LogModuleNameEnum; +import com.engine.organization.enums.OperateTypeEnum; +import com.engine.organization.mapper.scheme.GradeMapper; import com.engine.organization.service.GradeService; import com.engine.organization.service.impl.GradeServiceImpl; -import org.apache.ibatis.annotations.Param; +import com.engine.organization.util.OrganizationWrapper; +import com.engine.organization.util.db.MapperProxyFactory; import weaver.hrm.User; import java.util.Collection; +import java.util.List; import java.util.Map; /** @@ -17,11 +25,18 @@ import java.util.Map; * @createTime: 2022/05/11 * @version: 1.0 */ -public class GradeWrapper extends Service { +public class GradeWrapper extends OrganizationWrapper { + + private GradeService getGradeService(User user) { return ServiceUtil.getService(GradeServiceImpl.class, user); } + private GradeMapper getGradeMapper() { + return MapperProxyFactory.getProxy(GradeMapper.class); + } + + /** * 职级列表 * @@ -38,8 +53,12 @@ public class GradeWrapper extends Service { * @param param * @return */ + @Log(operateType = OperateTypeEnum.ADD, operateModule = LogModuleNameEnum.GRADE, operateDesc = "新增职级") public int saveGrade(GradeSearchParam param) { - return getGradeService(user).saveGrade(param); + int saveGrade = getGradeService(user).saveGrade(param); + writeOperateLog(new Object() { + }.getClass(), param.getGradeName(), JSON.toJSONString(param), "新增职级"); + return saveGrade; } /** @@ -48,8 +67,13 @@ public class GradeWrapper extends Service { * @param param * @return */ + @Log(operateType = OperateTypeEnum.UPDATE, operateModule = LogModuleNameEnum.GRADE, operateDesc = "更新职级") public int updateGrade(GradeSearchParam param) { - return getGradeService(user).updateGrade(param); + GradePO original = getGradeMapper().getGradeByID(param.getId()); + int updateGrade = getGradeService(user).updateGrade(param); + writeOperateLog(new Object() { + }.getClass(), original.getGradeName(), JSON.toJSONString(param), original, getGradeMapper().getGradeByID(param.getId())); + return updateGrade; } /** @@ -57,8 +81,13 @@ public class GradeWrapper extends Service { * * @param params */ + @Log(operateType = OperateTypeEnum.UPDATE, operateModule = LogModuleNameEnum.GRADE, operateDesc = "更新职级禁用标识") public int updateForbiddenTagById(GradeSearchParam params) { - return getGradeService(user).updateForbiddenTagById(params); + GradePO original = getGradeMapper().getGradeByID(params.getId()); + int updateForbiddenTagById = getGradeService(user).updateForbiddenTagById(params); + writeOperateLog(new Object() { + }.getClass(), original.getGradeName(), JSON.toJSONString(params), original, getGradeMapper().getGradeByID(params.getId())); + return updateForbiddenTagById; } /** @@ -66,8 +95,15 @@ public class GradeWrapper extends Service { * * @param ids */ - public int deleteByIds(@Param("ids") Collection ids) { - return getGradeService(user).deleteByIds(ids); + @Log(operateType = OperateTypeEnum.DELETE, operateModule = LogModuleNameEnum.GRADE, operateDesc = "删除职级") + public int deleteByIds(Collection ids) { + List gradeNameByIds = getGradeMapper().getGradeNameByIds(ids); + int deleteByIds = getGradeService(user).deleteByIds(ids); + for (String gradeName : gradeNameByIds) { + writeOperateLog(new Object() { + }.getClass(), gradeName, JSON.toJSONString(ids), "删除职级"); + } + return deleteByIds; } /** diff --git a/src/com/engine/organization/wrapper/GroupWrapper.java b/src/com/engine/organization/wrapper/GroupWrapper.java index ec205f9f..4296b797 100644 --- a/src/com/engine/organization/wrapper/GroupWrapper.java +++ b/src/com/engine/organization/wrapper/GroupWrapper.java @@ -1,9 +1,9 @@ package com.engine.organization.wrapper; import com.engine.common.util.ServiceUtil; -import com.engine.core.impl.Service; import com.engine.organization.service.GroupService; import com.engine.organization.service.impl.GroupServiceImpl; +import com.engine.organization.util.OrganizationWrapper; import weaver.hrm.User; import java.util.Map; @@ -14,7 +14,7 @@ import java.util.Map; * @createTime: 2022/05/16 * @version: 1.0 */ -public class GroupWrapper extends Service { +public class GroupWrapper extends OrganizationWrapper { private GroupService getGroupService(User user) { return ServiceUtil.getService(GroupServiceImpl.class, user); } @@ -37,7 +37,8 @@ public class GroupWrapper extends Service { * @return */ public boolean updateGroup(Map params) { - return getGroupService(user).updateGroup(params); + boolean updateGroup = getGroupService(user).updateGroup(params); + return updateGroup; } /** diff --git a/src/com/engine/organization/wrapper/HrmResourceWrapper.java b/src/com/engine/organization/wrapper/HrmResourceWrapper.java index fa3dace7..b31d1dbb 100644 --- a/src/com/engine/organization/wrapper/HrmResourceWrapper.java +++ b/src/com/engine/organization/wrapper/HrmResourceWrapper.java @@ -1,11 +1,12 @@ package com.engine.organization.wrapper; import com.engine.common.util.ServiceUtil; -import com.engine.core.impl.Service; +import com.engine.organization.entity.hrmresource.param.HrmRelationSaveParam; import com.engine.organization.entity.hrmresource.param.HrmResourceSearchParam; import com.engine.organization.entity.searchtree.SearchTreeParams; import com.engine.organization.service.HrmResourceService; import com.engine.organization.service.impl.HrmResourceServiceImpl; +import com.engine.organization.util.OrganizationWrapper; import weaver.hrm.User; import java.util.Map; @@ -15,7 +16,7 @@ import java.util.Map; * @createTime: 2022/06/21 * @version: 1.0 */ -public class HrmResourceWrapper extends Service { +public class HrmResourceWrapper extends OrganizationWrapper { private HrmResourceService getHrmResourceService(User user) { return ServiceUtil.getService(HrmResourceServiceImpl.class, user); } @@ -34,7 +35,8 @@ public class HrmResourceWrapper extends Service { } public Long saveBaseForm(Map params) { - return getHrmResourceService(user).saveBaseForm(params); + Long resourceId = getHrmResourceService(user).saveBaseForm(params); + return resourceId; } public Map getBaseForm(Map params) { @@ -42,7 +44,8 @@ public class HrmResourceWrapper extends Service { } public int updateForm(Map params) { - return getHrmResourceService(user).updateForm(params); + int updateForm = getHrmResourceService(user).updateForm(params); + return updateForm; } public Map getSearchCondition(Map params) { @@ -52,4 +55,17 @@ public class HrmResourceWrapper extends Service { public Map getHasRight() { return getHrmResourceService(user).getHasRight(); } + + public Map getTabForm(Map params) { + return getHrmResourceService(user).getTabForm(params); + } + + public long saveTabForm(HrmRelationSaveParam params) { + return getHrmResourceService(user).saveTabForm(params); + } + + public long updateTabForm(HrmRelationSaveParam params) { + return getHrmResourceService(user).updateTabForm(params); + } + } diff --git a/src/com/engine/organization/wrapper/ImportCommonWrapper.java b/src/com/engine/organization/wrapper/ImportCommonWrapper.java new file mode 100644 index 00000000..2a5d99c5 --- /dev/null +++ b/src/com/engine/organization/wrapper/ImportCommonWrapper.java @@ -0,0 +1,26 @@ +package com.engine.organization.wrapper; + +import com.engine.common.util.ServiceUtil; +import com.engine.core.impl.Service; +import com.engine.organization.service.ImportCommonService; +import com.engine.organization.service.impl.ImportCommonServiceImpl; +import weaver.hrm.User; + +import javax.servlet.http.HttpServletRequest; +import java.util.Map; + +/** + * @author:dxfeng + * @createTime: 2022/06/29 + * @version: 1.0 + */ +public class ImportCommonWrapper extends Service { + + private ImportCommonService getImportCommonService(User user) { + return ServiceUtil.getService(ImportCommonServiceImpl.class, user); + } + + public Map saveImportResource(Map params, HttpServletRequest request) { + return getImportCommonService(user).saveImportResource(params, request); + } +} diff --git a/src/com/engine/organization/wrapper/JobWrapper.java b/src/com/engine/organization/wrapper/JobWrapper.java index 9a870adb..9262b54a 100644 --- a/src/com/engine/organization/wrapper/JobWrapper.java +++ b/src/com/engine/organization/wrapper/JobWrapper.java @@ -1,19 +1,31 @@ package com.engine.organization.wrapper; +import com.alibaba.fastjson.JSON; import com.api.browser.bean.SearchConditionGroup; import com.api.browser.bean.SearchConditionItem; import com.engine.common.util.ServiceUtil; -import com.engine.core.impl.Service; +import com.engine.organization.annotation.Log; +import com.engine.organization.entity.DeleteParam; +import com.engine.organization.entity.job.param.JobCopyParam; import com.engine.organization.entity.job.param.JobMergeParam; import com.engine.organization.entity.job.param.JobSearchParam; +import com.engine.organization.entity.job.po.JobPO; import com.engine.organization.entity.searchtree.SearchTreeParams; +import com.engine.organization.enums.LogModuleNameEnum; +import com.engine.organization.enums.OperateTypeEnum; +import com.engine.organization.mapper.job.JobMapper; import com.engine.organization.service.JobService; import com.engine.organization.service.impl.JobServiceImpl; import com.engine.organization.util.OrganizationFormItemUtil; +import com.engine.organization.util.OrganizationWrapper; +import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.response.ReturnResult; import weaver.hrm.User; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; /** * @description: @@ -21,11 +33,15 @@ import java.util.*; * @createTime: 2022/05/27 * @version: 1.0 */ -public class JobWrapper extends Service { +public class JobWrapper extends OrganizationWrapper { private JobService getJobService(User user) { return ServiceUtil.getService(JobServiceImpl.class, user); } + private JobMapper getJobMapper() { + return MapperProxyFactory.getProxy(JobMapper.class); + } + /** * 左侧树 * @@ -90,8 +106,12 @@ public class JobWrapper extends Service { * @param params * @return */ + @Log(operateType = OperateTypeEnum.ADD, operateModule = LogModuleNameEnum.JOB, operateDesc = "新增岗位") public Long saveBaseForm(Map params) { - return getJobService(user).saveBaseForm(params); + Long jobId = getJobService(user).saveBaseForm(params); + writeOperateLog(new Object() { + }.getClass(), params.get("job_name").toString(), JSON.toJSONString(params), "新增岗位"); + return jobId; } /** @@ -100,27 +120,46 @@ public class JobWrapper extends Service { * @param params * @return */ + @Log(operateType = OperateTypeEnum.UPDATE, operateModule = LogModuleNameEnum.JOB, operateDesc = "更新岗位") public Long updateForm(Map params) { - return getJobService(user).updateForm(params); + long id = Long.parseLong(params.get("id").toString()); + JobPO jobById = getJobMapper().getJobById(id); + Long jobId = getJobService(user).updateForm(params); + writeOperateLog(new Object() { + }.getClass(), jobById.getJobName(), JSON.toJSONString(params), jobById, getJobMapper().getJobById(id)); + return jobId; } /** * 复制岗位到指定部门 * - * @param ids - * @param department + * @param param * @return */ - public int copyJobItem(String ids, String department) { - return getJobService(user).copyJobItem(ids, department); + @Log(operateType = OperateTypeEnum.COPY, operateModule = LogModuleNameEnum.JOB, operateDesc = "复制岗位") + public int copyJobItem(JobCopyParam param) { + List jobPOS = getJobMapper().getJobsByIds(DeleteParam.builder().ids(param.getIds()).build().getIds()); + int copyJobItem = getJobService(user).copyJobItem(param.getIds(), param.getDepartment()); + for (JobPO jobPO : jobPOS) { + writeOperateLog(new Object() { + }.getClass(), jobPO.getJobName(), JSON.toJSONString(param), "复制岗位[" + jobPO.getJobName() + "]"); + } + return copyJobItem; } /** + * 更新禁用标识 + * * @param params * @return */ + @Log(operateType = OperateTypeEnum.UPDATE, operateModule = LogModuleNameEnum.JOB, operateDesc = "更新岗位禁用标识") public int updateForbiddenTagById(JobSearchParam params) { - return getJobService(user).updateForbiddenTagById(params); + JobPO jobById = getJobMapper().getJobById(params.getId()); + int updateForbiddenTagById = getJobService(user).updateForbiddenTagById(params); + writeOperateLog(new Object() { + }.getClass(), jobById.getJobNo(), JSON.toJSONString(params), jobById, getJobMapper().getJobById(params.getId())); + return updateForbiddenTagById; } /** @@ -129,8 +168,15 @@ public class JobWrapper extends Service { * @param ids * @return */ + @Log(operateType = OperateTypeEnum.DELETE, operateModule = LogModuleNameEnum.JOB, operateDesc = "删除岗位") public int deleteByIds(Collection ids) { - return getJobService(user).deleteByIds(ids); + List jobPOS = getJobMapper().getJobsByIds(ids); + int deleteByIds = getJobService(user).deleteByIds(ids); + for (JobPO jobPO : jobPOS) { + writeOperateLog(new Object() { + }.getClass(), jobPO.getJobName(), JSON.toJSONString(ids), "删除岗位"); + } + return deleteByIds; } @@ -164,7 +210,13 @@ public class JobWrapper extends Service { return getJobService(user).getMergeForm(); } + @Log(operateType = OperateTypeEnum.MERGE, operateModule = LogModuleNameEnum.JOB, operateDesc = "合并岗位") public int mergeJob(JobMergeParam mergeParam) { - return getJobService(user).mergeJob(mergeParam); + JobPO jobById = getJobMapper().getJobById(mergeParam.getId()); + int mergeJob = getJobService(user).mergeJob(mergeParam); + writeOperateLog(new Object() { + }.getClass(), jobById.getJobNo(), JSON.toJSONString(mergeParam), jobById, getJobMapper().getJobById(mergeParam.getId())); + + return mergeJob; } } diff --git a/src/com/engine/organization/wrapper/LevelWrapper.java b/src/com/engine/organization/wrapper/LevelWrapper.java index a3430d6b..c3160208 100644 --- a/src/com/engine/organization/wrapper/LevelWrapper.java +++ b/src/com/engine/organization/wrapper/LevelWrapper.java @@ -1,15 +1,22 @@ package com.engine.organization.wrapper; +import com.alibaba.fastjson.JSON; import com.engine.common.util.ServiceUtil; -import com.engine.core.impl.Service; +import com.engine.organization.annotation.Log; import com.engine.organization.entity.TreeData; import com.engine.organization.entity.scheme.param.LevelSearchParam; +import com.engine.organization.entity.scheme.po.LevelPO; +import com.engine.organization.enums.LogModuleNameEnum; +import com.engine.organization.enums.OperateTypeEnum; +import com.engine.organization.mapper.scheme.LevelMapper; import com.engine.organization.service.LevelService; import com.engine.organization.service.impl.LevelServiceImpl; -import org.apache.ibatis.annotations.Param; +import com.engine.organization.util.OrganizationWrapper; +import com.engine.organization.util.db.MapperProxyFactory; import weaver.hrm.User; import java.util.Collection; +import java.util.List; import java.util.Map; /** @@ -18,11 +25,15 @@ import java.util.Map; * @createTime: 2022/05/10 * @version: 1.0 */ -public class LevelWrapper extends Service { +public class LevelWrapper extends OrganizationWrapper { private LevelService getLevelService(User user) { return ServiceUtil.getService(LevelServiceImpl.class, user); } + private LevelMapper getLevelMapper() { + return MapperProxyFactory.getProxy(LevelMapper.class); + } + /** * 职等列表 * @@ -39,8 +50,12 @@ public class LevelWrapper extends Service { * @param param * @return */ + @Log(operateType = OperateTypeEnum.ADD, operateModule = LogModuleNameEnum.LEVEL, operateDesc = "新增职等") public int saveLevel(LevelSearchParam param) { - return getLevelService(user).saveLevel(param); + int saveLevel = getLevelService(user).saveLevel(param); + writeOperateLog(new Object() { + }.getClass(), param.getLevelName(), JSON.toJSONString(param), "新增职等"); + return saveLevel; } /** @@ -49,8 +64,13 @@ public class LevelWrapper extends Service { * @param param * @return */ + @Log(operateType = OperateTypeEnum.UPDATE, operateModule = LogModuleNameEnum.LEVEL, operateDesc = "更新职等") public int updateLevel(LevelSearchParam param) { - return getLevelService(user).updateLevel(param); + LevelPO levelByID = getLevelMapper().getLevelByID(param.getId()); + int updateLevel = getLevelService(user).updateLevel(param); + writeOperateLog(new Object() { + }.getClass(), levelByID.getLevelName(), JSON.toJSONString(param), levelByID, getLevelMapper().getLevelByID(param.getId())); + return updateLevel; } /** @@ -58,8 +78,13 @@ public class LevelWrapper extends Service { * * @param params */ + @Log(operateType = OperateTypeEnum.UPDATE, operateModule = LogModuleNameEnum.LEVEL, operateDesc = "更新职等禁用标识") public int updateForbiddenTagById(LevelSearchParam params) { - return getLevelService(user).updateForbiddenTagById(params); + LevelPO levelByID = getLevelMapper().getLevelByID(params.getId()); + int updateForbiddenTagById = getLevelService(user).updateForbiddenTagById(params); + writeOperateLog(new Object() { + }.getClass(), levelByID.getLevelName(), JSON.toJSONString(params), levelByID, getLevelMapper().getLevelByID(params.getId())); + return updateForbiddenTagById; } /** @@ -67,8 +92,15 @@ public class LevelWrapper extends Service { * * @param ids */ - public int deleteByIds(@Param("ids") Collection ids) { - return getLevelService(user).deleteByIds(ids); + @Log(operateType = OperateTypeEnum.DELETE, operateModule = LogModuleNameEnum.LEVEL, operateDesc = "删除职等") + public int deleteByIds(Collection ids) { + List levelPOS = getLevelMapper().getLevelsByIds(ids); + int deleteByIds = getLevelService(user).deleteByIds(ids); + for (LevelPO levelPO : levelPOS) { + writeOperateLog(new Object() { + }.getClass(), levelPO.getLevelName(), JSON.toJSONString(ids), "删除职等"); + } + return deleteByIds; } /** diff --git a/src/com/engine/organization/wrapper/LogViewWrapper.java b/src/com/engine/organization/wrapper/LogViewWrapper.java new file mode 100644 index 00000000..a40ba337 --- /dev/null +++ b/src/com/engine/organization/wrapper/LogViewWrapper.java @@ -0,0 +1,29 @@ +package com.engine.organization.wrapper; + +import com.engine.common.util.ServiceUtil; +import com.engine.organization.entity.logview.param.LogViewSearchParam; +import com.engine.organization.service.LogViewService; +import com.engine.organization.service.impl.LogViewServiceImpl; +import com.engine.organization.util.OrganizationWrapper; +import weaver.hrm.User; + +import java.util.Map; + +/** + * @author:dxfeng + * @createTime: 2022/07/05 + * @version: 1.0 + */ +public class LogViewWrapper extends OrganizationWrapper { + private LogViewService getLogViewService(User user) { + return ServiceUtil.getService(LogViewServiceImpl.class, user); + } + + public Map listPage(LogViewSearchParam params) { + return getLogViewService(user).listPage(params); + } + + public Map getSearchCondition() { + return getLogViewService(user).getSearchCondition(); + } +} diff --git a/src/com/engine/organization/wrapper/OrgChartWrapper.java b/src/com/engine/organization/wrapper/OrgChartWrapper.java new file mode 100644 index 00000000..5ec82c64 --- /dev/null +++ b/src/com/engine/organization/wrapper/OrgChartWrapper.java @@ -0,0 +1,34 @@ +package com.engine.organization.wrapper; + +import com.engine.common.util.ServiceUtil; +import com.engine.core.impl.Service; +import com.engine.organization.service.OrgChartService; +import com.engine.organization.service.impl.OrgChartServiceImpl; +import weaver.hrm.User; + +import java.util.Map; + +/** + * @className: OrgChartWrapper + * @author: dengjp + * @date: 2022/7/7 + * @description: 组织架构图Wrapper + **/ +public class OrgChartWrapper extends Service { + private OrgChartService getOrgChartService(User user) { + return ServiceUtil.getService(OrgChartServiceImpl.class, user); + } + + + public Map getOptionCondition(Map request2Map, User user) { + return getOrgChartService(user).getOptionCondition(request2Map, user); + } + + public Map getCompanyData(Map request2Map, User user) { + return getOrgChartService(user).getCompanyData(request2Map, user); + } + + public Map getUserData(Map request2Map, User user) { + return getOrgChartService(user).getUserData(request2Map, user); + } +} diff --git a/src/com/engine/organization/wrapper/PostInfoWrapper.java b/src/com/engine/organization/wrapper/PostInfoWrapper.java index 579863e3..7b671a3c 100644 --- a/src/com/engine/organization/wrapper/PostInfoWrapper.java +++ b/src/com/engine/organization/wrapper/PostInfoWrapper.java @@ -1,14 +1,21 @@ package com.engine.organization.wrapper; +import com.alibaba.fastjson.JSON; import com.engine.common.util.ServiceUtil; -import com.engine.core.impl.Service; +import com.engine.organization.annotation.Log; import com.engine.organization.entity.postion.param.PostInfoSearchParam; +import com.engine.organization.entity.postion.po.PostInfoPO; +import com.engine.organization.enums.LogModuleNameEnum; +import com.engine.organization.enums.OperateTypeEnum; +import com.engine.organization.mapper.post.PostInfoMapper; import com.engine.organization.service.PostInfoService; import com.engine.organization.service.impl.PostInfoServiceImpl; -import org.apache.ibatis.annotations.Param; +import com.engine.organization.util.OrganizationWrapper; +import com.engine.organization.util.db.MapperProxyFactory; import weaver.hrm.User; import java.util.Collection; +import java.util.List; import java.util.Map; /** @@ -17,11 +24,15 @@ import java.util.Map; * @createTime: 2022/05/13 * @version: 1.0 */ -public class PostInfoWrapper extends Service { +public class PostInfoWrapper extends OrganizationWrapper { private PostInfoService getPostInfoService(User user) { return ServiceUtil.getService(PostInfoServiceImpl.class, user); } + private PostInfoMapper getPostInfoMapper() { + return MapperProxyFactory.getProxy(PostInfoMapper.class); + } + /** * 职务信息列表 * @@ -38,8 +49,13 @@ public class PostInfoWrapper extends Service { * @param param * @return */ + @Log(operateType = OperateTypeEnum.ADD, operateModule = LogModuleNameEnum.POSTINFO, operateDesc = "新增职务信息") public int savePostInfo(PostInfoSearchParam param) { - return getPostInfoService(user).savePostInfo(param); + int savePostInfo = getPostInfoService(user).savePostInfo(param); + writeOperateLog(new Object() { + }.getClass(), param.getPostInfoName(), JSON.toJSONString(param), "新增职务信息"); + + return savePostInfo; } /** @@ -48,8 +64,13 @@ public class PostInfoWrapper extends Service { * @param param * @return */ + @Log(operateType = OperateTypeEnum.UPDATE, operateModule = LogModuleNameEnum.POSTINFO, operateDesc = "更新职务信息") public int updatePostInfo(PostInfoSearchParam param) { - return getPostInfoService(user).updatePostInfo(param); + PostInfoPO postInfoByID = getPostInfoMapper().getPostInfoByID(param.getId()); + int updatePostInfo = getPostInfoService(user).updatePostInfo(param); + writeOperateLog(new Object() { + }.getClass(), postInfoByID.getPostInfoName(), JSON.toJSONString(param), postInfoByID, getPostInfoMapper().getPostInfoByID(param.getId())); + return updatePostInfo; } /** @@ -57,8 +78,13 @@ public class PostInfoWrapper extends Service { * * @param params */ + @Log(operateType = OperateTypeEnum.UPDATE, operateModule = LogModuleNameEnum.POSTINFO, operateDesc = "更新职务信息禁用标识") public int updateForbiddenTagById(PostInfoSearchParam params) { - return getPostInfoService(user).updateForbiddenTagById(params); + PostInfoPO postInfoByID = getPostInfoMapper().getPostInfoByID(params.getId()); + int updateForbiddenTagById = getPostInfoService(user).updateForbiddenTagById(params); + writeOperateLog(new Object() { + }.getClass(), postInfoByID.getPostInfoName(), JSON.toJSONString(params), postInfoByID, getPostInfoMapper().getPostInfoByID(params.getId())); + return updateForbiddenTagById; } /** @@ -66,8 +92,15 @@ public class PostInfoWrapper extends Service { * * @param ids */ - public int deleteByIds(@Param("ids") Collection ids) { - return getPostInfoService(user).deleteByIds(ids); + @Log(operateType = OperateTypeEnum.DELETE, operateModule = LogModuleNameEnum.POSTINFO, operateDesc = "删除职务信息") + public int deleteByIds(Collection ids) { + List postInfoPOS = getPostInfoMapper().getPostInfosByIds(ids); + int deleteByIds = getPostInfoService(user).deleteByIds(ids); + for (PostInfoPO postInfoPO : postInfoPOS) { + writeOperateLog(new Object() { + }.getClass(), postInfoPO.getPostInfoName(), JSON.toJSONString(ids), "删除职务信息"); + } + return deleteByIds; } /** diff --git a/src/com/engine/organization/wrapper/PostWrapper.java b/src/com/engine/organization/wrapper/PostWrapper.java index 7457c0a5..74ede385 100644 --- a/src/com/engine/organization/wrapper/PostWrapper.java +++ b/src/com/engine/organization/wrapper/PostWrapper.java @@ -1,15 +1,21 @@ package com.engine.organization.wrapper; +import com.alibaba.fastjson.JSON; import com.engine.common.util.ServiceUtil; -import com.engine.core.impl.Service; +import com.engine.organization.annotation.Log; import com.engine.organization.entity.TreeData; import com.engine.organization.entity.postion.po.PostPO; +import com.engine.organization.enums.LogModuleNameEnum; +import com.engine.organization.enums.OperateTypeEnum; +import com.engine.organization.mapper.post.PostMapper; import com.engine.organization.service.PostService; import com.engine.organization.service.impl.PostServiceImpl; -import org.apache.ibatis.annotations.Param; +import com.engine.organization.util.OrganizationWrapper; +import com.engine.organization.util.db.MapperProxyFactory; import weaver.hrm.User; import java.util.Collection; +import java.util.List; import java.util.Map; /** @@ -18,19 +24,27 @@ import java.util.Map; * @createTime: 2022/05/13 * @version: 1.0 */ -public class PostWrapper extends Service { +public class PostWrapper extends OrganizationWrapper { private PostService getPostService(User user) { return ServiceUtil.getService(PostServiceImpl.class, user); } + private PostMapper getPostMapper() { + return MapperProxyFactory.getProxy(PostMapper.class); + } + /** * 新增职务分类 * * @param postPO * @return */ + @Log(operateType = OperateTypeEnum.ADD, operateModule = LogModuleNameEnum.POSTINFO, operateDesc = "新增职务分类") public int savePost(PostPO postPO) { - return getPostService(user).savePost(postPO); + int savePost = getPostService(user).savePost(postPO); + writeOperateLog(new Object() { + }.getClass(), postPO.getPostName(), JSON.toJSONString(postPO), "新增职务分类"); + return savePost; } /** @@ -39,8 +53,13 @@ public class PostWrapper extends Service { * @param postPO * @return */ + @Log(operateType = OperateTypeEnum.UPDATE, operateModule = LogModuleNameEnum.POSTINFO, operateDesc = "更新职务分类") public int updatePost(PostPO postPO) { - return getPostService(user).updatePost(postPO); + PostPO postByID = getPostMapper().getPostByID(postPO.getId()); + int updatePost = getPostService(user).updatePost(postPO); + writeOperateLog(new Object() { + }.getClass(), postByID.getPostName(), JSON.toJSONString(postPO), postByID, getPostMapper().getPostByID(postPO.getId())); + return updatePost; } /** @@ -48,8 +67,15 @@ public class PostWrapper extends Service { * * @param ids */ - public int deleteByIds(@Param("ids") Collection ids) { - return getPostService(user).deleteByIds(ids); + @Log(operateType = OperateTypeEnum.DELETE, operateModule = LogModuleNameEnum.POSTINFO, operateDesc = "删除职务分类") + public int deleteByIds(Collection ids) { + List postPOS = getPostMapper().getPostsByIds(ids); + int deleteByIds = getPostService(user).deleteByIds(ids); + for (PostPO postPO : postPOS) { + writeOperateLog(new Object() { + }.getClass(), postPO.getPostName(), JSON.toJSONString(ids), "删除职务分类"); + } + return deleteByIds; } /** @@ -64,6 +90,7 @@ public class PostWrapper extends Service { /** * 获取左侧树 + * * @return */ public TreeData getTreeData() { diff --git a/src/com/engine/organization/wrapper/SchemeWrapper.java b/src/com/engine/organization/wrapper/SchemeWrapper.java index 2f8727ad..abec2fbf 100644 --- a/src/com/engine/organization/wrapper/SchemeWrapper.java +++ b/src/com/engine/organization/wrapper/SchemeWrapper.java @@ -1,12 +1,18 @@ package com.engine.organization.wrapper; +import com.alibaba.fastjson.JSON; import com.engine.common.util.ServiceUtil; -import com.engine.core.impl.Service; +import com.engine.organization.annotation.Log; import com.engine.organization.entity.fieldset.vo.TypeTreeVO; import com.engine.organization.entity.scheme.param.SchemeSearchParam; +import com.engine.organization.entity.scheme.po.SchemePO; +import com.engine.organization.enums.LogModuleNameEnum; +import com.engine.organization.enums.OperateTypeEnum; +import com.engine.organization.mapper.scheme.SchemeMapper; import com.engine.organization.service.SchemeService; import com.engine.organization.service.impl.SchemeServiceImpl; -import org.apache.ibatis.annotations.Param; +import com.engine.organization.util.OrganizationWrapper; +import com.engine.organization.util.db.MapperProxyFactory; import weaver.hrm.User; import java.util.Collection; @@ -19,12 +25,16 @@ import java.util.Map; * @Date 2022/5/9 * @Version V1.0 **/ -public class SchemeWrapper extends Service { +public class SchemeWrapper extends OrganizationWrapper { private SchemeService getSchemeService(User user) { return ServiceUtil.getService(SchemeServiceImpl.class, user); } + private SchemeMapper getSchemeMapper() { + return MapperProxyFactory.getProxy(SchemeMapper.class); + } + /** * 等级方案列表 * @@ -41,8 +51,12 @@ public class SchemeWrapper extends Service { * @param param * @return */ - public Map save(SchemeSearchParam param) { - return getSchemeService(user).save(param); + @Log(operateType = OperateTypeEnum.ADD, operateModule = LogModuleNameEnum.SCHEME, operateDesc = "新增等级方案") + public int save(SchemeSearchParam param) { + int save = getSchemeService(user).save(param); + writeOperateLog(new Object() { + }.getClass(), param.getSchemeName(), JSON.toJSONString(param), "新增等级方案"); + return save; } /** @@ -51,8 +65,13 @@ public class SchemeWrapper extends Service { * @param param * @return */ - public Map updateScheme(SchemeSearchParam param) { - return getSchemeService(user).updateScheme(param); + @Log(operateType = OperateTypeEnum.UPDATE, operateModule = LogModuleNameEnum.SCHEME, operateDesc = "更新等级方案") + public int updateScheme(SchemeSearchParam param) { + SchemePO schemeByID = getSchemeMapper().getSchemeByID(param.getId()); + int updateScheme = getSchemeService(user).updateScheme(param); + writeOperateLog(new Object() { + }.getClass(), schemeByID.getSchemeName(), JSON.toJSONString(param), schemeByID, getSchemeMapper().getSchemeByID(param.getId())); + return updateScheme; } /** @@ -60,8 +79,13 @@ public class SchemeWrapper extends Service { * * @param params */ - public void updateForbiddenTagById(SchemeSearchParam params) { - getSchemeService(user).updateForbiddenTagById(params); + @Log(operateType = OperateTypeEnum.UPDATE, operateModule = LogModuleNameEnum.SCHEME, operateDesc = "更新等级方案禁用标识") + public int updateForbiddenTagById(SchemeSearchParam params) { + SchemePO schemeByID = getSchemeMapper().getSchemeByID(params.getId()); + int updateForbiddenTagById = getSchemeService(user).updateForbiddenTagById(params); + writeOperateLog(new Object() { + }.getClass(), schemeByID.getSchemeName(), JSON.toJSONString(params), schemeByID, getSchemeMapper().getSchemeByID(params.getId())); + return updateForbiddenTagById; } /** @@ -69,8 +93,16 @@ public class SchemeWrapper extends Service { * * @param ids */ - public void deleteByIds(@Param("ids") Collection ids) { - getSchemeService(user).deleteByIds(ids); + @Log(operateType = OperateTypeEnum.DELETE, operateModule = LogModuleNameEnum.SCHEME, operateDesc = "删除等级方案") + public int deleteByIds(Collection ids) { + List schemePOS = getSchemeMapper().getSchemesByIds(ids); + int deleteByIds = getSchemeService(user).deleteByIds(ids); + for (SchemePO schemePO : schemePOS) { + writeOperateLog(new Object() { + }.getClass(), schemePO.getSchemeName(), JSON.toJSONString(ids), "删除等级方案"); + + } + return deleteByIds; } diff --git a/src/com/engine/organization/wrapper/SequenceWrapper.java b/src/com/engine/organization/wrapper/SequenceWrapper.java index 7715d247..fdfe22ff 100644 --- a/src/com/engine/organization/wrapper/SequenceWrapper.java +++ b/src/com/engine/organization/wrapper/SequenceWrapper.java @@ -1,14 +1,21 @@ package com.engine.organization.wrapper; +import com.alibaba.fastjson.JSON; import com.engine.common.util.ServiceUtil; -import com.engine.core.impl.Service; +import com.engine.organization.annotation.Log; import com.engine.organization.entity.sequence.param.SequenceSearchParam; +import com.engine.organization.entity.sequence.po.SequencePO; +import com.engine.organization.enums.LogModuleNameEnum; +import com.engine.organization.enums.OperateTypeEnum; +import com.engine.organization.mapper.sequence.SequenceMapper; import com.engine.organization.service.SequenceService; import com.engine.organization.service.impl.SequenceServiceImpl; -import org.apache.ibatis.annotations.Param; +import com.engine.organization.util.OrganizationWrapper; +import com.engine.organization.util.db.MapperProxyFactory; import weaver.hrm.User; import java.util.Collection; +import java.util.List; import java.util.Map; /** @@ -17,11 +24,15 @@ import java.util.Map; * @createTime: 2022/05/12 * @version: 1.0 */ -public class SequenceWrapper extends Service { +public class SequenceWrapper extends OrganizationWrapper { private SequenceService getSequenceService(User user) { return ServiceUtil.getService(SequenceServiceImpl.class, user); } + private SequenceMapper getSequenceMapper() { + return MapperProxyFactory.getProxy(SequenceMapper.class); + } + /** * 岗位列表 * @@ -38,8 +49,12 @@ public class SequenceWrapper extends Service { * @param param * @return */ + @Log(operateType = OperateTypeEnum.ADD, operateModule = LogModuleNameEnum.SEQUENCE, operateDesc = "新增岗位序列") public int saveSequence(SequenceSearchParam param) { - return getSequenceService(user).saveSequence(param); + int saveSequence = getSequenceService(user).saveSequence(param); + writeOperateLog(new Object() { + }.getClass(), param.getSequenceName(), JSON.toJSONString(param), "新增岗位序列"); + return saveSequence; } /** @@ -48,17 +63,27 @@ public class SequenceWrapper extends Service { * @param param * @return */ + @Log(operateType = OperateTypeEnum.UPDATE, operateModule = LogModuleNameEnum.SEQUENCE, operateDesc = "更新岗位序列") public int updateSequence(SequenceSearchParam param) { - return getSequenceService(user).updateSequence(param); + SequencePO sequenceByID = getSequenceMapper().getSequenceByID(param.getId()); + int updateSequence = getSequenceService(user).updateSequence(param); + writeOperateLog(new Object() { + }.getClass(), sequenceByID.getSequenceName(), JSON.toJSONString(param), sequenceByID, getSequenceMapper().getSequenceByID(param.getId())); + return updateSequence; } /** * 更新禁用标记 * - * @param params + * @param param */ - public int updateForbiddenTagById(SequenceSearchParam params) { - return getSequenceService(user).updateForbiddenTagById(params); + @Log(operateType = OperateTypeEnum.UPDATE, operateModule = LogModuleNameEnum.SEQUENCE, operateDesc = "更新岗位序列禁用标识") + public int updateForbiddenTagById(SequenceSearchParam param) { + SequencePO sequenceByID = getSequenceMapper().getSequenceByID(param.getId()); + int updateForbiddenTagById = getSequenceService(user).updateForbiddenTagById(param); + writeOperateLog(new Object() { + }.getClass(), sequenceByID.getSequenceName(), JSON.toJSONString(param), sequenceByID, getSequenceMapper().getSequenceByID(param.getId())); + return updateForbiddenTagById; } /** @@ -66,8 +91,15 @@ public class SequenceWrapper extends Service { * * @param ids */ - public int deleteByIds(@Param("ids") Collection ids) { - return getSequenceService(user).deleteByIds(ids); + @Log(operateType = OperateTypeEnum.DELETE, operateModule = LogModuleNameEnum.SEQUENCE, operateDesc = "删除岗位序列") + public int deleteByIds( Collection ids) { + List sequencePOS = getSequenceMapper().getSequencesByIds(ids); + int deleteByIds = getSequenceService(user).deleteByIds(ids); + for (SequencePO sequencePO : sequencePOS) { + writeOperateLog(new Object() { + }.getClass(), sequencePO.getSequenceName(), JSON.toJSONString(ids), "删除岗位序列"); + } + return deleteByIds; } /** diff --git a/src/com/engine/organization/wrapper/StaffPlanWrapper.java b/src/com/engine/organization/wrapper/StaffPlanWrapper.java index dbf96297..bd9628fb 100644 --- a/src/com/engine/organization/wrapper/StaffPlanWrapper.java +++ b/src/com/engine/organization/wrapper/StaffPlanWrapper.java @@ -1,14 +1,22 @@ package com.engine.organization.wrapper; +import com.alibaba.fastjson.JSON; import com.engine.common.util.ServiceUtil; -import com.engine.core.impl.Service; +import com.engine.organization.annotation.Log; import com.engine.organization.entity.staff.param.StaffPlanSearchParam; +import com.engine.organization.entity.staff.po.StaffPlanPO; +import com.engine.organization.enums.LogModuleNameEnum; +import com.engine.organization.enums.OperateTypeEnum; +import com.engine.organization.mapper.staff.StaffPlanMapper; import com.engine.organization.service.StaffPlanService; import com.engine.organization.service.impl.StaffPlanServiceImpl; +import com.engine.organization.util.OrganizationWrapper; +import com.engine.organization.util.db.MapperProxyFactory; import org.apache.ibatis.annotations.Param; import weaver.hrm.User; import java.util.Collection; +import java.util.List; import java.util.Map; /** @@ -17,11 +25,15 @@ import java.util.Map; * @createTime: 2022/05/25 * @version: 1.0 */ -public class StaffPlanWrapper extends Service { +public class StaffPlanWrapper extends OrganizationWrapper { private StaffPlanService getStaffPlanService(User user) { return ServiceUtil.getService(StaffPlanServiceImpl.class, user); } + private StaffPlanMapper getStaffPlanMapper() { + return MapperProxyFactory.getProxy(StaffPlanMapper.class); + } + /** * 编制方案列表 * @@ -38,8 +50,12 @@ public class StaffPlanWrapper extends Service { * @param param * @return */ + @Log(operateType = OperateTypeEnum.ADD, operateModule = LogModuleNameEnum.STAFFPLAN, operateDesc = "新增编制方案") public int saveStaffPlan(StaffPlanSearchParam param) { - return getStaffPlanService(user).saveStaffPlan(param); + int saveStaffPlan = getStaffPlanService(user).saveStaffPlan(param); + writeOperateLog(new Object() { + }.getClass(), param.getPlanName(), JSON.toJSONString(param), "新增编制方案"); + return saveStaffPlan; } /** @@ -48,17 +64,27 @@ public class StaffPlanWrapper extends Service { * @param param * @return */ + @Log(operateType = OperateTypeEnum.UPDATE, operateModule = LogModuleNameEnum.STAFFPLAN, operateDesc = "更新编制方案") public int updateStaffPlan(StaffPlanSearchParam param) { - return getStaffPlanService(user).updateStaffPlan(param); + StaffPlanPO staffPlanByID = getStaffPlanMapper().getStaffPlanByID(param.getId()); + int updateStaffPlan = getStaffPlanService(user).updateStaffPlan(param); + writeOperateLog(new Object() { + }.getClass(), staffPlanByID.getPlanName(), JSON.toJSONString(param), staffPlanByID, getStaffPlanMapper().getStaffPlanByID(param.getId())); + return updateStaffPlan; } /** * 更新禁用标记 * - * @param params + * @param param */ - public int updateForbiddenTagById(StaffPlanSearchParam params) { - return getStaffPlanService(user).updateForbiddenTagById(params); + @Log(operateType = OperateTypeEnum.UPDATE, operateModule = LogModuleNameEnum.STAFFPLAN, operateDesc = "更新编制方案禁用标识") + public int updateForbiddenTagById(StaffPlanSearchParam param) { + StaffPlanPO staffPlanByID = getStaffPlanMapper().getStaffPlanByID(param.getId()); + int updateForbiddenTagById = getStaffPlanService(user).updateForbiddenTagById(param); + writeOperateLog(new Object() { + }.getClass(), staffPlanByID.getPlanName(), JSON.toJSONString(param), staffPlanByID, getStaffPlanMapper().getStaffPlanByID(param.getId())); + return updateForbiddenTagById; } /** @@ -66,8 +92,15 @@ public class StaffPlanWrapper extends Service { * * @param ids */ + @Log(operateType = OperateTypeEnum.DELETE, operateModule = LogModuleNameEnum.STAFFPLAN, operateDesc = "删除编制方案") public int deleteByIds(@Param("ids") Collection ids) { - return getStaffPlanService(user).deleteByIds(ids); + List staffPlanPOS = getStaffPlanMapper().getStaffPlansByIds(ids); + int deleteByIds = getStaffPlanService(user).deleteByIds(ids); + for (StaffPlanPO staffPlanPO : staffPlanPOS) { + writeOperateLog(new Object() { + }.getClass(), staffPlanPO.getPlanName(), JSON.toJSONString(ids), "删除编制方案"); + } + return deleteByIds; } /** diff --git a/src/com/engine/organization/wrapper/StaffWrapper.java b/src/com/engine/organization/wrapper/StaffWrapper.java index e781782c..597f2b9c 100644 --- a/src/com/engine/organization/wrapper/StaffWrapper.java +++ b/src/com/engine/organization/wrapper/StaffWrapper.java @@ -1,14 +1,25 @@ package com.engine.organization.wrapper; +import com.alibaba.fastjson.JSON; import com.engine.common.util.ServiceUtil; -import com.engine.core.impl.Service; +import com.engine.organization.annotation.Log; import com.engine.organization.entity.staff.param.StaffSearchParam; +import com.engine.organization.entity.staff.po.StaffPO; +import com.engine.organization.entity.staff.po.StaffPlanPO; +import com.engine.organization.enums.LogModuleNameEnum; +import com.engine.organization.enums.OperateTypeEnum; +import com.engine.organization.mapper.staff.StaffMapper; +import com.engine.organization.mapper.staff.StaffPlanMapper; import com.engine.organization.service.StaffService; import com.engine.organization.service.impl.StaffServiceImpl; +import com.engine.organization.util.OrganizationWrapper; +import com.engine.organization.util.db.MapperProxyFactory; import weaver.hrm.User; import java.util.Collection; +import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * @description: @@ -16,11 +27,19 @@ import java.util.Map; * @createTime: 2022/05/25 * @version: 1.0 */ -public class StaffWrapper extends Service { +public class StaffWrapper extends OrganizationWrapper { private StaffService getStaffService(User user) { return ServiceUtil.getService(StaffServiceImpl.class, user); } + private StaffMapper getStaffMapper() { + return MapperProxyFactory.getProxy(StaffMapper.class); + } + + private StaffPlanMapper getStaffPlanMapper() { + return MapperProxyFactory.getProxy(StaffPlanMapper.class); + } + /** * 编制列表 * @@ -37,8 +56,12 @@ public class StaffWrapper extends Service { * @param param * @return */ + @Log(operateType = OperateTypeEnum.ADD, operateModule = LogModuleNameEnum.STAFF, operateDesc = "新增编制上报") public int saveStaff(StaffSearchParam param) { - return getStaffService(user).saveStaff(param); + int saveStaff = getStaffService(user).saveStaff(param); + writeOperateLog(new Object() { + }.getClass(), getStaffPlanMapper().getStaffPlanByID(param.getPlanId()).getPlanName(), JSON.toJSONString(param), "新增编制上报"); + return saveStaff; } /** @@ -47,8 +70,13 @@ public class StaffWrapper extends Service { * @param param * @return */ + @Log(operateType = OperateTypeEnum.UPDATE, operateModule = LogModuleNameEnum.STAFF, operateDesc = "更新编制上报") public int updateStaff(StaffSearchParam param) { - return getStaffService(user).updateStaff(param); + StaffPO staffByID = getStaffMapper().getStaffByID(param.getId()); + int updateStaff = getStaffService(user).updateStaff(param); + writeOperateLog(new Object() { + }.getClass(), getStaffPlanMapper().getStaffPlanByID(param.getPlanId()).getPlanName(), JSON.toJSONString(param), staffByID, getStaffMapper().getStaffByID(param.getId())); + return updateStaff; } @@ -57,8 +85,17 @@ public class StaffWrapper extends Service { * * @param ids */ + @Log(operateType = OperateTypeEnum.DELETE, operateModule = LogModuleNameEnum.STAFF, operateDesc = "删除编制上报") public int deleteByIds(Collection ids) { - return getStaffService(user).deleteByIds(ids); + List staffPOS = getStaffMapper().getStaffsByIds(ids); + List staffPlansByIds = getStaffPlanMapper().getStaffPlansByIds(ids); + Map collect = staffPlansByIds.stream().collect(Collectors.toMap(StaffPlanPO::getId, StaffPlanPO::getPlanName)); + int deleteByIds = getStaffService(user).deleteByIds(ids); + for (StaffPO staffPO : staffPOS) { + writeOperateLog(new Object() { + }.getClass(), collect.get(staffPO.getId()), JSON.toJSONString(ids), "删除编制上报"); + } + return deleteByIds; } /**