diff --git a/resource/sqlupgrade/Mysql/报表.sql b/resource/sqlupgrade/Mysql/报表.sql new file mode 100644 index 000000000..4fa33dc8b --- /dev/null +++ b/resource/sqlupgrade/Mysql/报表.sql @@ -0,0 +1,244 @@ +create table hrsa_sub_table +( + id bigint primary key comment 'ID' , + create_time datetime comment '创建时间' , + update_time datetime comment '修改时间' , + creator bigint comment '创建人id' , + delete_type int default 0 comment '是否删除' , + tenant_key varchar(10) comment '租户KEY' , + sub_table_name varchar(100) not null comment '表名' , + dimension varchar(20) not null comment '统计维度' , + start_month varchar(10) comment '开始月' , + end_month varchar(10) comment '终止月' , + pay_org_string varchar(500) comment '个税扣缴义务人高级搜索' , + pay_agency_string varchar(500) comment '缴纳组织高级搜索' , + sub_company_string varchar(500) comment '分部高级搜索' , + depart_string varchar(500) comment '部门高级搜索' , + grade_string varchar(500) comment '职级高级搜索' , + position_string varchar(500) comment '岗位高级搜索' , + status_string varchar(500) comment '人员状态高级搜索' , + employee_type varchar(500) comment '人员类型高级搜索' , + employee_string varchar(500) comment '人员高级搜索' , + payment_type_string varchar(100) comment '缴纳类型' +) +; + +create table hrsa_sub_table_item +( + id bigint primary key comment 'ID' , + create_time datetime comment '创建时间' , + update_time datetime comment '修改时间' , + creator bigint comment '创建人id' , + delete_type int default 0 comment '是否删除' , + tenant_key varchar(10) comment '租户KEY' , + table_id bigint not null comment '数据表id' , + item_name varchar(50) not null comment '统计项名称' , + item_value varchar(500) not null comment '统计项集合' , + index_value int not null comment '顺序' , + total_rule varchar(500) comment '合计规则' , + count_rule varchar(500) comment '计数规则' , + unit_type int default 2 comment '统计单位' +) +; + +alter table hrsa_sub_table add table_type int +; + +alter table hrsa_sub_table modify column table_type int default 0 +; + +create table hrsa_salary_stats_dim +( + id bigint primary key comment 'ID' , + create_time datetime comment '创建时间' , + update_time datetime comment '修改时间' , + creator bigint comment '创建人id' , + delete_type int default 0 comment '是否删除' , + tenant_key varchar(10) comment '租户KEY' , + dim_name varchar(100) comment '统计维度名称' , + dim_type varchar(20) comment '统计维度类型' , + remark varchar(500) comment '描述' , + setting varchar(2000) comment '设置内容', + is_default int comment '是否默认' , + dim_code varchar(50) comment '统计维度编码' +) +; + +create table hrsa_salary_stats_report +( + id bigint primary key comment 'ID' , + create_time datetime comment '创建时间' , + update_time datetime comment '修改时间' , + creator bigint comment '创建人id' , + delete_type int default 0 comment '是否删除' , + tenant_key varchar(10) comment '租户KEY' , + report_name varchar(100) comment '报表名称' , + dimension varchar(1000) comment '统计维度(多个的话以逗号分隔)' , + tax_agent_setting varchar(1000) comment '个税扣缴义务人配置' , + income_category_setting varchar(20) comment '收入所得项目配置' , + sub_company_setting varchar(1000) comment '分部配置' , + depart_setting varchar(1000) comment '部门配置' , + grade_setting varchar(1000) comment '职级配置' , + position_setting varchar(1000) comment '岗位配置' , + status_setting varchar(1000) comment '状态配置' , + employee_setting varchar(1000) comment '人员配置' , + hiredate_setting varchar(1000) comment '入职日期配置' , + leavedate_setting varchar(1000) comment '离职日期配置' , + salary_start_month datetime comment '薪资所属月份-起始' , + salary_end_month datetime comment '薪资所属月份-截止' +) +; + +create table hrsa_salary_statistics_item +( + id bigint primary key comment 'ID' , + create_time datetime comment '创建时间' , + update_time datetime comment '修改时间' , + creator bigint comment '创建人id' , + delete_type int default 0 comment '是否删除' , + tenant_key varchar(10) comment '租户KEY' , + item_name varchar(50) comment '统计项名称' , + item_value varchar(1000) comment '统计项集合' , + count_rule varchar(500) comment '计数规则' , + sum_rule varchar(500) comment '求和规则' , + avg_rule varchar(500) comment '平均值规则' , + max_rule varchar(500) comment '最大值规则' , + min_rule varchar(500) comment '最小值规则' , + median_rule varchar(500) comment '中位数规则' , + index_value int comment '顺序' , + unit_type int comment '统计单位', + stat_report_id bigint comment '统计报表id' +) +; + +create table hrsa_charts_setting +( + id bigint primary key comment 'ID' , + create_time datetime comment '创建时间' , + update_time datetime comment '修改时间' , + creator bigint comment '创建人id' , + delete_type int default 0 comment '是否删除' , + tenant_key varchar(10) comment '租户KEY' , + table_id bigint not null comment '报表id' , + charts_type int not null comment '报表类型' , + item_values varchar(500) comment '统计项目' , + item_col_value varchar(50) not null comment '统计列' , + dimension_range int not null comment '维度统计范围' , + item_sort_value varchar(500) comment '排序统计项目' , + item_col_sort_value varchar(50) comment '排序列' , + sort_type int comment '排序类型' , + sort_num int comment '排序取数值' +) +; + +create table hrsa_salary_echarts_setting +( + id bigint primary key comment 'ID' , + create_time datetime comment '创建时间' , + update_time datetime comment '修改时间' , + creator bigint comment '创建人id' , + delete_type int default 0 comment '是否删除' , + tenant_key varchar(10) comment '租户KEY' , + report_id bigint not null comment '报表id' , + charts_type int not null comment '报表类型' , + item_values varchar(500) comment '统计项目' , + item_col_value varchar(50) not null comment '统计列' , + dimension_range int not null comment '维度统计范围' , + item_sort_value varchar(500) comment '排序统计项目' , + item_col_sort_value varchar(50) comment '排序列' , + sort_type int comment '排序类型' , + sort_num int comment '排序取数值' +) +; + +alter table hrsa_salary_stats_dim modify column dim_type varchar(30) +; + +alter table hrsa_salary_stats_report modify column income_category_setting varchar(1000) +; + +create table hrsa_statreportlogs_detail +( + id bigint primary key comment 'ID' , + create_time datetime comment '创建时间' , + update_time datetime comment '修改时间' , + creator bigint comment '创建人id' , + delete_type int default 0 comment '是否删除' , + tenant_key varchar(10) comment '租户KEY' , + uuid varchar(36) not null comment '日志UUID' , + mainid varchar(36) not null comment '主表id' , + dataid varchar(50) not null comment '数据id' , + belongdataid varchar(50) not null comment '主表数据id' , + tablename varchar(200) not null comment '表名' , + tablenamelabelid varchar(50) default '-1' not null comment '表名labelid' , + tablenamedesc varchar(50) not null comment '对应数据库的表' , + fieldname varchar(200) not null comment '字段名' , + fieldnamelabelid varchar(50) default '-1' not null comment '字段名labelid' , + newvalue text not null comment '更新后的值' , + oldvalue text not null comment '更新前的值' , + newrealvalue text not null comment '更新后的显示值' , + oldrealvalue text not null comment '更新前的显示值' , + fielddesc varchar(200) not null comment '字段名' , + showorder int(11) not null comment '字段名' , + isdetail int(11) default 0 not null comment '是否明细字段' +) +; + +create table hrsa_statreportlogs +( + id bigint primary key comment 'ID' , + create_time datetime comment '创建时间' , + update_time datetime comment '修改时间' , + creator bigint comment '创建人id' , + delete_type int default 0 comment '是否删除' , + tenant_key varchar(10) comment '租户KEY' , + uuid varchar(36) not null comment '日志UUID' , + log_date datetime not null comment '记录时间' , + device varchar(500) not null comment '终端信息' , + log_operator bigint not null comment '操作者' , + operatorname varchar(100) comment '操作人姓名' , + targetid bigint default '-1' not null comment '操作目标id' , + targetname text not null comment '操作目标名称' , + modulename varchar(100) not null comment '模块' , + functionname varchar(100) not null comment '服务(方法)' , + interfacename varchar(100) not null comment '访问接口名' , + requesturl varchar(200) not null comment '请求全路径' , + requesturi varchar(200) not null comment '请求地址' , + operatetype varchar(50) not null comment '操作类型' , + operatetypename varchar(100) not null comment '操作类型名称' , + operatedesc varchar(3000) not null comment '操作详细说明' , + params text not null comment '涉及的相关参数' , + belongmainid varchar(36) not null comment '所属主表uuid' , + clientip varchar(50) not null comment '操作IP' , + groupid varchar(50) not null comment '分组' , + groupnamelabel varchar(1000) not null comment '分组标题' , + redoservice varchar(200) not null comment '重做业务接口' , + redocontext text not null comment '重做参数' , + cancelservice varchar(200) not null comment '撤销业务接口' , + cancelcontext text not null comment '撤销参数' , + totalruntime bigint default '0' not null comment '总运行时长' , + mainruntime bigint default '0' not null comment '主方法运行时长' , + log_result varchar(100) not null comment '日志结果' , + fromterminal varchar(100) not null comment '来自pc web' , + resultdesc text not null comment '运行结果描述' , + old_content varchar(3000) not null comment '原先内容' , + link_type varchar(20) not null comment '链接类型' , + link_id bigint default '0' not null comment '链接id' , + old_link_id bigint default '0' not null comment '原先链接id' +) +; + +alter table hrsa_salary_stats_report add remark varchar(100) +; + +alter table hrsa_salary_stats_report add second_dimension varchar(100) +; + +alter table hrsa_salary_stats_report add sort_index varchar(100) +; + +alter table hrsa_salary_stats_report add sort_type varchar(100) +; + +alter table hrsa_salary_stats_dim add label_id int +; \ No newline at end of file diff --git a/resource/sqlupgrade/Mysql/浏览按钮.sql b/resource/sqlupgrade/Mysql/浏览按钮.sql new file mode 100644 index 000000000..de0b61e6f --- /dev/null +++ b/resource/sqlupgrade/Mysql/浏览按钮.sql @@ -0,0 +1,38 @@ +select @current_date:= date_format( now(),'%Y-%m-%d'); +select @current_time:= date_format( now(),'%T'); +INSERT INTO datashowset(SHOWNAME, SHOWCLASS, DATAFROM, DATASOURCEID, SQLTEXT, WSURL, WSOPERATION, XMLTEXT, INPARA, SHOWTYPE, KEYFIELD, PARENTFIELD, SHOWFIELD, DETAILPAGEURL, TYPENAME, SELECTTYPE, SHOWPAGEURL, BROWSERFROM, NAME, CUSTOMID, CUSTOMHREF, SQLTEXT1, SQLTEXT2, NAMEHEADER, DESCRIPTIONHEADER, WSWORKNAME, SEARCHBYID, CREATEDATE, CREATETIME, MODIFYDATE, MODIFYTIME, SEARCHBYNAME, onlylowestnode, characterset, uuid, isSupportPaging, ESBID, ESBSHOWID, mobiledetailpageurl, isPhyPage, subcompanyid, unconditionalQuery) VALUES ('salaryItemBrowser', '1', '1', '', 'select * from hrsa_salary_item where delete_type = 0', '', '', '', '', '1', 'id', '', '', '', '', '', '', 2, '薪资项目', NULL, '', NULL, NULL, NULL, NULL, '', '', @current_date, @current_time, NULL, NULL, '', '', '0',uuid(), '', '', '', '', '1', 0, 1); +select @datashowset_id:= max(id) from datashowset; +INSERT INTO datashowcacheset(showname, subcompanyid, isopencache, Createdate, createtime, Updatedate, Updatetime) VALUES ('salaryItemBrowser', '0', 0, @current_date, @current_time, NULL, NULL); +INSERT INTO datashowparam(MAINID, FIELDNAME, SEARCHNAME, TRANSQL, ISSHOWNAME, dsporder, uuid, width) VALUES (@datashowset_id, '名称', 'name', '', 1, 1, uuid(), NULL); +INSERT INTO datasearchparam(MAINID, FIELDNAME, SEARCHNAME, FIELDTYPE, WOKFLOWFIELDNAME, dsporder, uuid, isshowfield) VALUES (@datashowset_id, '名称', 'name', '2', '', 1, uuid(), ''); + + + + +declare @datashowset_id int +declare @current_date varchar(100) +declare @current_time varchar(100) + +set @current_date = (select CONVERT(varchar(100), GETDATE(), 23)) +set @current_time = (select CONVERT(varchar(100), GETDATE(), 24)) + +INSERT INTO datashowset(SHOWNAME, SHOWCLASS, DATAFROM, DATASOURCEID, SQLTEXT, WSURL, WSOPERATION, XMLTEXT, INPARA, SHOWTYPE, KEYFIELD, PARENTFIELD, SHOWFIELD, DETAILPAGEURL, TYPENAME, SELECTTYPE, SHOWPAGEURL, BROWSERFROM, NAME, CUSTOMID, CUSTOMHREF, SQLTEXT1, SQLTEXT2, NAMEHEADER, DESCRIPTIONHEADER, WSWORKNAME, SEARCHBYID, CREATEDATE, CREATETIME, MODIFYDATE, MODIFYTIME, SEARCHBYNAME, onlylowestnode, characterset, uuid, isSupportPaging, ESBID, ESBSHOWID, mobiledetailpageurl, isPhyPage, subcompanyid, unconditionalQuery) VALUES ('salaryItemBrowser', '1', '1', '', 'select * from hrsa_salary_item where delete_type = 0', '', '', '', '', '1', 'id', '', '', '', '', '', '', 2, '薪资项目', NULL, '', NULL, NULL, NULL, NULL, '', '', @current_date, @current_time, NULL, NULL, '', '', '0',newid(), '', '', '', '', '1', 0, 1) +set @datashowset_id = (select max(id) from datashowset) +INSERT INTO datashowcacheset(showname, subcompanyid, isopencache, Createdate, createtime, Updatedate, Updatetime) VALUES ('salaryItemBrowser', '0', 0, @current_date, @current_time, NULL, NULL) +INSERT INTO datashowparam(MAINID, FIELDNAME, SEARCHNAME, TRANSQL, ISSHOWNAME, dsporder, uuid, width) VALUES (@datashowset_id, '名称', 'name', '', 1, 1, newid(), NULL) +INSERT INTO datasearchparam(MAINID, FIELDNAME, SEARCHNAME, FIELDTYPE, WOKFLOWFIELDNAME, dsporder, uuid, isshowfield) VALUES (@datashowset_id, '名称', 'name', '2', '', 1, newid(), '') +GO + + + +declare +datashowset_id NUMBER; +hrmjobgroups_id NUMBER; +begin +INSERT INTO datashowset(SHOWNAME, SHOWCLASS, DATAFROM, DATASOURCEID, SQLTEXT, WSURL, WSOPERATION, XMLTEXT, INPARA, SHOWTYPE, KEYFIELD, PARENTFIELD, SHOWFIELD, DETAILPAGEURL, TYPENAME, SELECTTYPE, SHOWPAGEURL, BROWSERFROM, NAME, CUSTOMID, CUSTOMHREF, SQLTEXT1, SQLTEXT2, NAMEHEADER, DESCRIPTIONHEADER, WSWORKNAME, SEARCHBYID, CREATEDATE, CREATETIME, MODIFYDATE, MODIFYTIME, SEARCHBYNAME, onlylowestnode, characterset, uuid, isSupportPaging, ESBID, ESBSHOWID, mobiledetailpageurl, isPhyPage, subcompanyid, unconditionalQuery) VALUES ('salaryItemBrowser', '1', '1', '', 'select * from hrsa_salary_item where delete_type = 0', '', '', '', '', '1', 'id', '', '', '', '', '', '', 2, '薪资项目', NULL, '', NULL, NULL, NULL, NULL, '', '', TO_CHAR(SYSDATE,'yyyy-MM-dd'), TO_CHAR(SYSDATE,'HH24:mm:ss'), NULL, NULL, '', '', '0',SYS_GUID(), '', '', '', '', '1', 0, 1); +SELECT max(id) INTO datashowset_id FROM DATASHOWSET; +INSERT INTO datashowcacheset(showname, subcompanyid, isopencache, Createdate, createtime, Updatedate, Updatetime) VALUES ('salaryItemBrowser', '0', 0, TO_CHAR(SYSDATE,'yyyy-MM-dd'), TO_CHAR(SYSDATE,'HH24:mm:ss'), NULL, NULL); +INSERT INTO datashowparam(MAINID, FIELDNAME, SEARCHNAME, TRANSQL, ISSHOWNAME, dsporder, uuid, width) VALUES (datashowset_id, '名称', 'name', '', 1, 1, SYS_GUID(), NULL); +INSERT INTO datasearchparam(MAINID, FIELDNAME, SEARCHNAME, FIELDTYPE, WOKFLOWFIELDNAME, dsporder, uuid, isshowfield) VALUES (datashowset_id, '名称', 'name', '2', '', 1, SYS_GUID(), ''); +end; +/ \ No newline at end of file diff --git a/resource/sqlupgrade/Oracle/报表.sql b/resource/sqlupgrade/Oracle/报表.sql new file mode 100644 index 000000000..620dd24cb --- /dev/null +++ b/resource/sqlupgrade/Oracle/报表.sql @@ -0,0 +1,244 @@ +create table hrsa_sub_table +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + sub_table_name varchar2(100) not null, + dimension varchar2(20) not null, + start_month varchar2(10), + end_month varchar2(10), + pay_org_string varchar2(500), + pay_agency_string varchar2(500), + sub_company_string varchar2(500), + depart_string varchar2(500), + grade_string varchar2(500), + position_string varchar2(500), + status_string varchar2(500), + employee_type varchar2(500), + employee_string varchar2(500), + payment_type_string varchar2(100) +) +/ + +create table hrsa_sub_table_item +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + table_id number not null, + item_name varchar2(50) not null, + item_value varchar2(500) not null, + index_value int not null, + total_rule varchar2(500), + count_rule varchar2(500), + unit_type int default 2 +) +/ + +alter table hrsa_sub_table add table_type int +/ + +alter table hrsa_sub_table modify table_type default 0 +/ + +create table hrsa_salary_stats_dim +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + dim_name varchar2(100), + dim_type varchar2(20), + remark varchar2(500), + setting varchar2(2000), + is_default int, + dim_code varchar2(50) +) +/ + +create table hrsa_salary_stats_report +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + report_name varchar2(100), + dimension varchar2(1000), + tax_agent_setting varchar2(1000), + income_category_setting varchar2(20), + sub_company_setting varchar2(1000), + depart_setting varchar2(1000), + grade_setting varchar2(1000), + position_setting varchar2(1000), + status_setting varchar2(1000), + employee_setting varchar2(1000), + hiredate_setting varchar2(1000), + leavedate_setting varchar2(1000), + salary_start_month date, + salary_end_month date +) +/ + +create table hrsa_salary_statistics_item +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + item_name varchar2(50), + item_value varchar2(1000), + count_rule varchar2(500), + sum_rule varchar2(500), + avg_rule varchar2(500), + max_rule varchar2(500), + min_rule varchar2(500), + median_rule varchar2(500), + index_value int, + unit_type int, + stat_report_id number +) +/ + +create table hrsa_charts_setting +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + table_id number not null, + charts_type int not null, + item_values varchar2(500), + item_col_value varchar2(50) not null, + dimension_range int not null, + item_sort_value varchar2(500), + item_col_sort_value varchar2(50), + sort_type int, + sort_num int +) +/ + +create table hrsa_salary_echarts_setting +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + report_id number not null, + charts_type int not null, + item_values varchar2(500), + item_col_value varchar2(50) not null, + dimension_range int not null, + item_sort_value varchar2(500), + item_col_sort_value varchar2(50), + sort_type int, + sort_num int +) +/ + +alter table hrsa_salary_stats_dim modify dim_type varchar2(30) +/ + +alter table hrsa_salary_stats_report modify income_category_setting varchar2(1000) +/ + +create table hrsa_statreportlogs_detail +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + uuid varchar2(36) not null, + mainid varchar2(36) not null, + dataid varchar2(50) not null, + belongdataid varchar2(50) not null, + tablename varchar2(200) not null, + tablenamelabelid varchar2(50) default '-1' not null, + tablenamedesc varchar2(50) not null, + fieldname varchar2(200) not null, + fieldnamelabelid varchar2(50) default '-1' not null, + newvalue clob not null, + oldvalue clob not null, + newrealvalue clob not null, + oldrealvalue clob not null, + fielddesc varchar2(200) not null, + showorder int not null, + isdetail int default 0 not null +) +/ + +create table hrsa_statreportlogs +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + uuid varchar2(36) not null, + log_date date not null, + device varchar2(500) not null, + log_operator number not null, + operatorname varchar2(100), + targetid number default '-1' not null, + targetname clob not null, + modulename varchar2(100) not null, + functionname varchar2(100) not null, + interfacename varchar2(100) not null, + requesturl varchar2(200) not null, + requesturi varchar2(200) not null, + operatetype varchar2(50) not null, + operatetypename varchar2(100) not null, + operatedesc varchar2(3000) not null, + params clob not null, + belongmainid varchar2(36) not null, + clientip varchar2(50) not null, + groupid varchar2(50) not null, + groupnamelabel varchar2(1000) not null, + redoservice varchar2(200) not null, + redocontext clob not null, + cancelservice varchar2(200) not null, + cancelcontext clob not null, + totalruntime number default '0' not null, + mainruntime number default '0' not null, + log_result varchar2(100) not null, + fromterminal varchar2(100) not null, + resultdesc clob not null, + old_content varchar2(3000) not null, + link_type varchar2(20) not null, + link_id number default '0' not null, + old_link_id number default '0' not null +) +/ + +alter table hrsa_salary_stats_report add remark varchar2(100) +/ + +alter table hrsa_salary_stats_report add second_dimension varchar2(100) +/ + +alter table hrsa_salary_stats_report add sort_index varchar2(100) +/ + +alter table hrsa_salary_stats_report add sort_type varchar2(100) +/ + +alter table hrsa_salary_stats_dim add label_id int +/ \ No newline at end of file diff --git a/resource/sqlupgrade/SQLServer/报表.sql b/resource/sqlupgrade/SQLServer/报表.sql new file mode 100644 index 000000000..953eadd43 --- /dev/null +++ b/resource/sqlupgrade/SQLServer/报表.sql @@ -0,0 +1,244 @@ +create table hrsa_sub_table +( + id bigint primary key , + create_time datetime, + update_time datetime, + creator bigint, + delete_type int default 0, + tenant_key nvarchar(10), + sub_table_name nvarchar(100) not null, + dimension nvarchar(20) not null, + start_month nvarchar(10), + end_month nvarchar(10), + pay_org_string nvarchar(500), + pay_agency_string nvarchar(500), + sub_company_string nvarchar(500), + depart_string nvarchar(500), + grade_string nvarchar(500), + position_string nvarchar(500), + status_string nvarchar(500), + employee_type nvarchar(500), + employee_string nvarchar(500), + payment_type_string nvarchar(100) +) +GO + +create table hrsa_sub_table_item +( + id bigint primary key , + create_time datetime, + update_time datetime, + creator bigint, + delete_type int default 0, + tenant_key nvarchar(10), + table_id bigint not null, + item_name nvarchar(50) not null, + item_value nvarchar(500) not null, + index_value int not null, + total_rule nvarchar(500), + count_rule nvarchar(500), + unit_type int default 2 +) +GO + +alter table hrsa_sub_table add table_type int +GO + +alter table hrsa_sub_table add constraint df_table_type_7b1e7561 default 0 for table_type +GO + +create table hrsa_salary_stats_dim +( + id bigint primary key , + create_time datetime, + update_time datetime, + creator bigint, + delete_type int default 0, + tenant_key nvarchar(10), + dim_name nvarchar(100), + dim_type nvarchar(20), + remark nvarchar(500), + setting nvarchar(2000), + is_default int, + dim_code nvarchar(50) +) +GO + +create table hrsa_salary_stats_report +( + id bigint primary key , + create_time datetime, + update_time datetime, + creator bigint, + delete_type int default 0, + tenant_key nvarchar(10), + report_name nvarchar(100), + dimension nvarchar(1000), + tax_agent_setting nvarchar(1000), + income_category_setting nvarchar(20), + sub_company_setting nvarchar(1000), + depart_setting nvarchar(1000), + grade_setting nvarchar(1000), + position_setting nvarchar(1000), + status_setting nvarchar(1000), + employee_setting nvarchar(1000), + hiredate_setting varchar(1000), + leavedate_setting varchar(1000), + salary_start_month datetime, + salary_end_month datetime +) +GO + +create table hrsa_salary_statistics_item +( + id bigint primary key , + create_time datetime, + update_time datetime, + creator bigint, + delete_type int default 0, + tenant_key nvarchar(10), + item_name nvarchar(50), + item_value nvarchar(1000), + count_rule nvarchar(500), + sum_rule nvarchar(500), + avg_rule nvarchar(500), + max_rule nvarchar(500), + min_rule nvarchar(500), + median_rule nvarchar(500), + index_value int, + unit_type int, + stat_report_id bigint +) +GO + +create table hrsa_charts_setting +( + id bigint primary key , + create_time datetime, + update_time datetime, + creator bigint, + delete_type int default 0, + tenant_key nvarchar(10), + table_id bigint not null, + charts_type int not null, + item_values nvarchar(500), + item_col_value nvarchar(50) not null, + dimension_range int not null, + item_sort_value nvarchar(500), + item_col_sort_value nvarchar(50), + sort_type int, + sort_num int +) +GO + +create table hrsa_salary_echarts_setting +( + id bigint primary key , + create_time datetime, + update_time datetime, + creator bigint, + delete_type int default 0, + tenant_key nvarchar(10), + report_id bigint not null, + charts_type int not null, + item_values nvarchar(500), + item_col_value nvarchar(50) not null, + dimension_range int not null, + item_sort_value nvarchar(500), + item_col_sort_value nvarchar(50), + sort_type int, + sort_num int +) +GO + +alter table hrsa_salary_stats_dim alter column dim_type nvarchar(30) +GO + +alter table hrsa_salary_stats_report alter column income_category_setting nvarchar(1000) +GO + +create table hrsa_statreportlogs_detail +( + id bigint primary key , + create_time datetime, + update_time datetime, + creator bigint, + delete_type int default 0, + tenant_key nvarchar(10), + uuid nvarchar(36) not null, + mainid nvarchar(36) not null, + dataid nvarchar(50) not null, + belongdataid nvarchar(50) not null, + tablename nvarchar(200) not null, + tablenamelabelid nvarchar(50) default '-1' not null, + tablenamedesc nvarchar(50) not null, + fieldname nvarchar(200) not null, + fieldnamelabelid nvarchar(50) default '-1' not null, + newvalue nvarchar(max) not null, + oldvalue nvarchar(max) not null, + newrealvalue nvarchar(max) not null, + oldrealvalue nvarchar(max) not null, + fielddesc nvarchar(200) not null, + showorder int not null, + isdetail int default 0 not null +) +GO + +create table hrsa_statreportlogs +( + id bigint primary key , + create_time datetime, + update_time datetime, + creator bigint, + delete_type int default 0, + tenant_key nvarchar(10), + uuid nvarchar(36) not null, + log_date datetime not null, + device nvarchar(500) not null, + log_operator bigint not null, + operatorname nvarchar(100), + targetid bigint default '-1' not null, + targetname nvarchar(max) not null, + modulename nvarchar(100) not null, + functionname nvarchar(100) not null, + interfacename nvarchar(100) not null, + requesturl nvarchar(200) not null, + requesturi nvarchar(200) not null, + operatetype nvarchar(50) not null, + operatetypename nvarchar(100) not null, + operatedesc nvarchar(3000) not null, + params nvarchar(max) not null, + belongmainid nvarchar(36) not null, + clientip nvarchar(50) not null, + groupid nvarchar(50) not null, + groupnamelabel nvarchar(1000) not null, + redoservice nvarchar(200) not null, + redocontext nvarchar(max) not null, + cancelservice nvarchar(200) not null, + cancelcontext nvarchar(max) not null, + totalruntime bigint default '0' not null, + mainruntime bigint default '0' not null, + log_result nvarchar(100) not null, + fromterminal nvarchar(100) not null, + resultdesc nvarchar(max) not null, + old_content nvarchar(3000) not null, + link_type nvarchar(20) not null, + link_id bigint default '0' not null, + old_link_id bigint default '0' not null +) +GO + +alter table hrsa_salary_stats_report add remark nvarchar(100) +GO + +alter table hrsa_salary_stats_report add second_dimension nvarchar(100) +GO + +alter table hrsa_salary_stats_report add sort_index nvarchar(100) +GO + +alter table hrsa_salary_stats_report add sort_type nvarchar(100) +GO + +alter table hrsa_salary_stats_dim add label_id int +GO \ No newline at end of file diff --git a/src/com/engine/salary/entity/datacollection/DataCollectionEmployee.java b/src/com/engine/salary/entity/datacollection/DataCollectionEmployee.java index e5f56c1f4..0ae138533 100644 --- a/src/com/engine/salary/entity/datacollection/DataCollectionEmployee.java +++ b/src/com/engine/salary/entity/datacollection/DataCollectionEmployee.java @@ -95,6 +95,7 @@ public class DataCollectionEmployee { private String birthday; private Double workYear; + private Double companyWorkYear; private String idNo; diff --git a/src/com/engine/salary/mapper/datacollection/EmployMapper.xml b/src/com/engine/salary/mapper/datacollection/EmployMapper.xml index c4b515617..a564a5058 100644 --- a/src/com/engine/salary/mapper/datacollection/EmployMapper.xml +++ b/src/com/engine/salary/mapper/datacollection/EmployMapper.xml @@ -55,7 +55,9 @@ e.birthday as birthday, e.certificatenum as idNo, c.id as jobtitleId, - e.enddate as dismissdate + e.enddate as dismissdate, + e.workyear, + e.companyworkyear from hrmresource e left join hrmdepartment d on e.departmentid = d.id left join hrmjobtitles c on e.jobtitle = c.id diff --git a/src/com/engine/salary/report/entity/bo/SalaryStatisticsReportBO.java b/src/com/engine/salary/report/entity/bo/SalaryStatisticsReportBO.java index 311649ff4..3f39787ed 100644 --- a/src/com/engine/salary/report/entity/bo/SalaryStatisticsReportBO.java +++ b/src/com/engine/salary/report/entity/bo/SalaryStatisticsReportBO.java @@ -829,8 +829,8 @@ public class SalaryStatisticsReportBO { * @param salaryStatisticsItemList * @return */ - public static List buildReportColumns(String dimensionName, List salaryStatisticsItemList) { - List result = new ArrayList<>(); + public static List buildReportColumns(String dimensionName, List salaryStatisticsItemList) { + List result = new ArrayList<>(); result.add(new WeaTableColumnGroup("150", dimensionName, "dimension")); Map itemMap = salaryStatisticsItemList.stream().collect(Collectors.toMap(SalaryStatisticsItemPO::getId, Function.identity())); diff --git a/src/com/engine/salary/report/service/impl/SalaryStatisticsDimensionServiceImpl.java b/src/com/engine/salary/report/service/impl/SalaryStatisticsDimensionServiceImpl.java index 8c22c6f00..7d73ecb46 100644 --- a/src/com/engine/salary/report/service/impl/SalaryStatisticsDimensionServiceImpl.java +++ b/src/com/engine/salary/report/service/impl/SalaryStatisticsDimensionServiceImpl.java @@ -198,7 +198,7 @@ public class SalaryStatisticsDimensionServiceImpl extends Service implements Sal List list = getSalaryStatisticsDimensionMapper().listSome(SalaryStatisticsDimensionPO.builder().ids(ids).build()); boolean isDefault = list.stream().anyMatch(s -> NumberUtils.INTEGER_ONE.equals(s.getIsDefault())); if (CollectionUtils.isEmpty(list) || isDefault) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "默认统计维度不可删除!")); } // 被薪酬报表引用 diff --git a/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java b/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java index 4306f6bc8..09ec20bec 100644 --- a/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java +++ b/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java @@ -13,6 +13,7 @@ import com.engine.salary.mapper.report.SalaryStatisticsReportMapper; import com.engine.salary.report.common.constant.SalaryStatisticsDimensionConstant; import com.engine.salary.report.entity.bo.SalaryStatisticsReportBO; import com.engine.salary.report.entity.dto.SalaryStatisticsReportDataDTO; +import com.engine.salary.report.entity.param.SalaryStatisticsDimensionSaveParam; import com.engine.salary.report.entity.param.SalaryStatisticsReportDataQueryParam; import com.engine.salary.report.entity.param.SalaryStatisticsReportSaveParam; import com.engine.salary.report.entity.param.SalaryStatisticsSearchConditionSaveParam; @@ -31,10 +32,7 @@ import com.engine.salary.service.impl.SalaryAcctEmployeeServiceImpl; import com.engine.salary.service.impl.SalaryAcctResultServiceImpl; import com.engine.salary.service.impl.SalaryEmployeeServiceImpl; import com.engine.salary.service.impl.TaxAgentServiceImpl; -import com.engine.salary.util.SalaryAssert; -import com.engine.salary.util.SalaryDateUtil; -import com.engine.salary.util.SalaryEntityUtil; -import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.*; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; @@ -47,6 +45,7 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; +import weaver.general.Util; import weaver.hrm.User; import java.util.*; @@ -347,12 +346,12 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary return buildSubComRecords(data, salaryAcctResultValueMap); case SalaryStatisticsDimensionConstant.DM_DEPARTMENT: return buildDepartRecords(data, salaryAcctResultValueMap); - case SalaryStatisticsDimensionConstant.DM_POSITION: - return buildPositionRecords(data, salaryAcctResultValueMap); +// case SalaryStatisticsDimensionConstant.DM_POSITION: +// return buildPositionRecords(data, salaryAcctResultValueMap); // case SalaryStatisticsDimensionConstant.DM_GRADE: // return buildGradeRecords(data, salaryAcctResultValueMap); - case SalaryStatisticsDimensionConstant.DM_HRM_STATUS: - return buildStatusRecords(data, salaryAcctResultValueMap); +// case SalaryStatisticsDimensionConstant.DM_HRM_STATUS: +// return buildStatusRecords(data, salaryAcctResultValueMap); // case SalaryStatisticsDimensionConstant.DM_EMPLOYEE_TYPE: // return buildTypeRecords(data, salaryAcctResultValueMap); case SalaryStatisticsDimensionConstant.DM_EMPLOYEE: @@ -365,8 +364,8 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary return buildYearRecords(data, salaryAcctResultValueMap); // case SalaryStatisticsDimensionConstant.DM_SEX: // return buildSexRecords(data, salaryAcctResultValueMap); - case SalaryStatisticsDimensionConstant.DM_JOB_CALL: - return buildJobCallRecords(data, salaryAcctResultValueMap); +// case SalaryStatisticsDimensionConstant.DM_JOB_CALL: +// return buildJobCallRecords(data, salaryAcctResultValueMap); // case SalaryStatisticsDimensionConstant.DM_SUPERIOR: // return buildSuperiorRecords(data, salaryAcctResultValueMap); // case SalaryStatisticsDimensionConstant.DM_MARITAL_STATUS: @@ -391,13 +390,12 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary return new PageInfo<>(); } // 定量-组距式分组 + } else if (SalaryStatisticsDimensionTypeEnum.RATION_GROUP_SPACING.getValue().equals(dimension.getDimType())) { + return buildRationGroupSpacing4Records(dimension, data, salaryAcctResultValueMap); + // 定量-单项式分组 + } else if (SalaryStatisticsDimensionTypeEnum.RATION_GROUP_INDIVIDUAL.getValue().equals(dimension.getDimType())) { + return buildRationGroupIndividual4Records(dimension, data, salaryAcctResultValueMap); } -// else if (SalaryStatisticsDimensionTypeEnum.RATION_GROUP_SPACING.getValue().equals(dimension.getDimType())) { -// return buildRationGroupSpacing4Records(dimension, data, salaryAcctResultValueMap); -// // 定量-单项式分组 -// } else if (SalaryStatisticsDimensionTypeEnum.RATION_GROUP_INDIVIDUAL.getValue().equals(dimension.getDimType())) { -// return buildRationGroupIndividual4Records(dimension, data, salaryAcctResultValueMap); -// } return new PageInfo<>(); } @@ -1112,9 +1110,9 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary List sameSimpleUserInfoList; Map> map = Maps.newHashMap(); try { - simpleUserInfoList = CollectionUtils.isEmpty(employeeIds) ? Lists.newArrayList() : getSalaryEmployeeService(user).getEmployeeByIds(employeeIds); - lastSimpleUserInfoList = CollectionUtils.isEmpty(lastEmployeeIds) ? Lists.newArrayList() : getSalaryEmployeeService(user).getEmployeeByIds(lastEmployeeIds); - sameSimpleUserInfoList = CollectionUtils.isEmpty(sameEmployeeIds) ? Lists.newArrayList() : getSalaryEmployeeService(user).getEmployeeByIds(sameEmployeeIds); + simpleUserInfoList = CollectionUtils.isEmpty(employeeIds) ? Lists.newArrayList() : getSalaryEmployeeService(user).getEmployeeByIdsAll(employeeIds); + lastSimpleUserInfoList = CollectionUtils.isEmpty(lastEmployeeIds) ? Lists.newArrayList() : getSalaryEmployeeService(user).getEmployeeByIdsAll(lastEmployeeIds); + sameSimpleUserInfoList = CollectionUtils.isEmpty(sameEmployeeIds) ? Lists.newArrayList() : getSalaryEmployeeService(user).getEmployeeByIdsAll(sameEmployeeIds); } catch (Exception e) { log.info("获取员工个人信息失败: {}", e.getMessage()); return map; @@ -1596,76 +1594,81 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary // result.setList(records); // return result; // } -// -// private PageInfo> buildRationGroupSpacing4Records(SalaryStatisticsDimensionPO dimension, SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { -// PageInfo> result = new PageInfo<>(); -// List> records = new ArrayList<>(); -// -// // 分组设置 -// List groups = JsonUtil.parseList(dimension.getSetting(), SalaryStatisticsDimensionSaveParam.Setting4RationGroupSpacing.class); -// -// Map empIdYearMap = new HashMap<>(); -// Map lastEmpIdYearMap = new HashMap<>(); -// Map sameEmpIdYearMap = new HashMap<>(); -// -// String groupBelong; -// if (StringUtils.isEmpty(dimension.getDimCode())) { -// groupBelong = SalaryStatisticsReportBO.G_NO_ITEM; -// } else if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_AGE) || dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_WORK_YEAR) || dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_COMPANY_YEAR)) { -// groupBelong = SalaryStatisticsReportBO.G_YEAR; -// // 年份数据 -// handle4GroupYear(dimension, empIdYearMap, lastEmpIdYearMap, sameEmpIdYearMap, data); -// } else { -// groupBelong = SalaryStatisticsReportBO.G_ITEM; -// } -// groups.forEach(k -> { -// List salaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupSpacing(k, groupBelong, dimension.getDimCode(), data.getList(), empIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()); -// List lastSalaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupSpacing(k, groupBelong, dimension.getDimCode(), data.getLastList(), lastEmpIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()); -// List sameSalaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupSpacing(k, groupBelong, dimension.getDimCode(), data.getSameList(), sameEmpIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()); -// Map temp = new HashMap<>(); -// temp.put(DM, k.getStartValue() + "-" + k.getEndValue()); -// temp.putAll(SalaryStatisticsReportBO.calculateItem(salaryAcctEmployees, lastSalaryAcctEmployees, sameSalaryAcctEmployees, salaryAcctResultValueMap, data.getSalaryStatisticsItemList())); -// records.add(temp); -// }); -// -// result.setList(records); -// return result; -// } -// -// private void handle4GroupYear(SalaryStatisticsDimensionPO dimension, Map empIdYearMap, Map lastEmpIdYearMap, Map sameEmpIdYearMap, SalaryStatisticsReportDataDTO data) { -// Map> simpleUserInfoMap = getSimpleUserInfoList(data); -// if (simpleUserInfoMap.isEmpty()) { -// return; -// } -// simpleUserInfoMap.get(NOW_INFO).forEach(employee -> { + + private PageInfo> buildRationGroupSpacing4Records(SalaryStatisticsDimensionPO dimension, SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { + PageInfo> result = new PageInfo<>(); + List> records = new ArrayList<>(); + + // 分组设置 + List groups = JsonUtil.parseList(dimension.getSetting(), SalaryStatisticsDimensionSaveParam.Setting4RationGroupSpacing.class); + + Map empIdYearMap = new HashMap<>(); + Map lastEmpIdYearMap = new HashMap<>(); + Map sameEmpIdYearMap = new HashMap<>(); + + String groupBelong; + if (StringUtils.isEmpty(dimension.getDimCode())) { + groupBelong = SalaryStatisticsReportBO.G_NO_ITEM; + } else if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_AGE) || dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_WORK_YEAR) || dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_COMPANY_YEAR)) { + groupBelong = SalaryStatisticsReportBO.G_YEAR; + // 年份数据 + handle4GroupYear(dimension, empIdYearMap, lastEmpIdYearMap, sameEmpIdYearMap, data); + } else { + groupBelong = SalaryStatisticsReportBO.G_ITEM; + } + groups.forEach(k -> { + List salaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupSpacing(k, groupBelong, dimension.getDimCode(), data.getList(), empIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()); + List lastSalaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupSpacing(k, groupBelong, dimension.getDimCode(), data.getLastList(), lastEmpIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()); + List sameSalaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupSpacing(k, groupBelong, dimension.getDimCode(), data.getSameList(), sameEmpIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()); + Map temp = new HashMap<>(); + temp.put(DM, k.getStartValue() + "-" + k.getEndValue()); + temp.putAll(SalaryStatisticsReportBO.calculateItem(salaryAcctEmployees, lastSalaryAcctEmployees, sameSalaryAcctEmployees, salaryAcctResultValueMap, data.getSalaryStatisticsItemList())); + records.add(temp); + }); + + result.setList(records); + return result; + } + + private void handle4GroupYear(SalaryStatisticsDimensionPO dimension, Map empIdYearMap, Map lastEmpIdYearMap, Map sameEmpIdYearMap, SalaryStatisticsReportDataDTO data) { + Map> simpleUserInfoMap = getSimpleUserInfoList(data); + if (simpleUserInfoMap.isEmpty()) { + return; + } + simpleUserInfoMap.get(NOW_INFO).forEach(employee -> { // if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_AGE) && employee.getAge() != null) { // empIdYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getAge().toString()); -// } else if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_WORK_YEAR) && employee.getWorkYear() != null) { -// empIdYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getWorkYear().toString()); -// } else if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_COMPANY_YEAR) && StringUtils.isNotEmpty(employee.getCompanyYear())) { -// empIdYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getCompanyYear()); -// } -// }); -// simpleUserInfoMap.get(LAST_INFO).forEach(employee -> { +// } else + + if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_WORK_YEAR) && employee.getWorkYear() != null) { + empIdYearMap.put(employee.getEmployeeId(), Util.null2String(employee.getWorkYear())); + } else if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_COMPANY_YEAR) && employee.getCompanyWorkYear() != null) { + empIdYearMap.put(employee.getEmployeeId(), Util.null2String(employee.getCompanyWorkYear())); + } + }); + simpleUserInfoMap.get(LAST_INFO).forEach(employee -> { // if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_AGE) && employee.getAge() != null) { // lastEmpIdYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getAge().toString()); -// } else if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_WORK_YEAR) && employee.getWorkYear() != null) { -// lastEmpIdYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getWorkYear().toString()); -// } else if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_COMPANY_YEAR) && StringUtils.isNotEmpty(employee.getCompanyYear())) { -// lastEmpIdYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getCompanyYear()); -// } -// }); -// simpleUserInfoMap.get(SAME_INFO).forEach(employee -> { +// } else + + if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_WORK_YEAR) && employee.getWorkYear() != null) { + lastEmpIdYearMap.put(employee.getEmployeeId(), Util.null2String(employee.getWorkYear())); + } else if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_COMPANY_YEAR) && employee.getCompanyWorkYear() != null) { + lastEmpIdYearMap.put(employee.getEmployeeId(), Util.null2String(employee.getCompanyWorkYear())); + } + }); + simpleUserInfoMap.get(SAME_INFO).forEach(employee -> { // if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_AGE) && employee.getAge() != null) { // sameEmpIdYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getAge().toString()); -// } else if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_WORK_YEAR) && employee.getWorkYear() != null) { -// sameEmpIdYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getWorkYear().toString()); -// } else if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_COMPANY_YEAR) && StringUtils.isNotEmpty(employee.getCompanyYear())) { -// sameEmpIdYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getCompanyYear()); -// } -// }); -// } -// +// } else + if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_WORK_YEAR) && employee.getWorkYear() != null) { + sameEmpIdYearMap.put(employee.getEmployeeId(), Util.null2String(employee.getWorkYear())); + } else if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_COMPANY_YEAR) && employee.getCompanyWorkYear() != null) { + sameEmpIdYearMap.put(employee.getEmployeeId(), Util.null2String(employee.getCompanyWorkYear())); + } + }); + } + // private PageInfo> buildRationGroupIndividual4Records(SalaryStatisticsDimensionPO dimension, SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { // PageInfo> result = new PageInfo<>(); // List> records = new ArrayList<>(); diff --git a/src/com/engine/salary/report/wrapper/SalaryStatisticsReportWrapper.java b/src/com/engine/salary/report/wrapper/SalaryStatisticsReportWrapper.java index 15746671c..bd1d032e5 100644 --- a/src/com/engine/salary/report/wrapper/SalaryStatisticsReportWrapper.java +++ b/src/com/engine/salary/report/wrapper/SalaryStatisticsReportWrapper.java @@ -1,10 +1,10 @@ package com.engine.salary.report.wrapper; import com.alibaba.fastjson.JSONArray; -import com.cloudstore.eccom.pc.table.WeaTableColumn; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.component.WeaFormOption; +import com.engine.salary.component.WeaTableColumnGroup; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.report.entity.bo.SalaryStatisticsReportBO; import com.engine.salary.report.entity.param.SalaryStatisticsReportDataQueryParam; @@ -216,7 +216,7 @@ public class SalaryStatisticsReportWrapper extends Service { Map countResultMap = SalaryStatisticsReportBO.buildTotal(page, salaryStatisticsItemList, (long) user.getUID()); // 列表columns - List weaTableColumns = SalaryStatisticsReportBO.buildReportColumns(dimension.getDimName(), salaryStatisticsItemList); + List weaTableColumns = SalaryStatisticsReportBO.buildReportColumns(dimension.getDimName(), salaryStatisticsItemList); Map resultMap = Maps.newHashMap(); resultMap.putAll(JsonUtil.parseMap(weaTable, Object.class)); @@ -232,7 +232,7 @@ public class SalaryStatisticsReportWrapper extends Service { * @param param * @return */ - public Map exportData(SalaryStatisticsReportDataQueryParam param) { + public Map exportData(SalaryStatisticsReportDataQueryParam param) { if (param.getId() == null || param.getDimensionId() == null) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误")); } @@ -259,7 +259,7 @@ public class SalaryStatisticsReportWrapper extends Service { List> records = list.stream().map(m -> m.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue() + StringUtils.EMPTY))).collect(Collectors.toList()); // 获取列头 - List weaTableColumns = SalaryStatisticsReportBO.buildReportColumns(dimension.getDimName(), salaryStatisticsItemList); + List weaTableColumns = SalaryStatisticsReportBO.buildReportColumns(dimension.getDimName(), salaryStatisticsItemList); // 组装导出参数 // ExportCommonParam exportParam = SalaryStatisticsReportBO.buildExportParam(dimension.getDimName(), weaTableColumns, records); @@ -268,20 +268,33 @@ public class SalaryStatisticsReportWrapper extends Service { List rows = new ArrayList<>(); rows.add(weaTableColumns); + + List head = new ArrayList<>(); + weaTableColumns.forEach(weaTableColumn -> { + String column = weaTableColumn.getColumn(); + if (CollectionUtils.isEmpty(weaTableColumn.getChildren())) { + head.add(column); + } else { + weaTableColumn.getChildren().forEach(children -> { + head.add(children.getColumn()); + }); + } + }); + for (Map map : records) { List row = Lists.newArrayListWithExpectedSize(records.size()); - for (String k : map.keySet()) { + head.forEach(k -> { row.add(map.getOrDefault(k, StringUtils.EMPTY)); - } + }); rows.add(row); } String sheetName = SalaryI18nUtil.getI18nLabel(179263, "薪酬统计报表") + "-" + dimension.getDimName(); XSSFWorkbook book = ExcelUtilPlus.genWorkbookWithChildTitleColumn(rows, sheetName, true); - Map map = new HashMap<>(); - map.put("workbook",book); - map.put("fileName",sheetName); + Map map = new HashMap<>(); + map.put("workbook", book); + map.put("fileName", sheetName); return map; }