From 09b2bf54e1ee708dbaec7a1c7fbfd88639d43a7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Tue, 11 Apr 2023 09:22:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/sql/劳务所得.sql | 53 --- resource/sql/新增系统薪资项目.sql | 22 -- resource/sql/申报表.sql | 19 - resource/sql/申报表字段缺失.sql | 81 ---- resource/sql/薪酬总管理员权限项.sql | 30 -- resource/sql/账套新建不了.sql | 9 - .../report/SalaryStatisticsItemMapper.java | 72 ++++ .../report/SalaryStatisticsItemMapper.xml | 344 +++++++++++++++++ .../entity/bo/SalaryStatisticsReportBO.java | 325 ++++++++-------- .../entity/po/SalaryStatisticsItemPO.java | 9 +- .../SalaryStatisticsReportService.java | 11 +- .../report/service/SubTableExportService.java | 7 + .../impl/SalaryStatisticsItemServiceImpl.java | 136 +++---- .../SalaryStatisticsReportServiceImpl.java | 241 ++++++------ .../impl/SubTableExportServiceImpl.java | 186 +++++++++ .../web/SalaryStatisticsReportController.java | 157 ++++---- .../SalaryStatisticsReportWrapper.java | 358 +++++------------- 17 files changed, 1123 insertions(+), 937 deletions(-) delete mode 100644 resource/sql/劳务所得.sql delete mode 100644 resource/sql/新增系统薪资项目.sql delete mode 100644 resource/sql/申报表.sql delete mode 100644 resource/sql/申报表字段缺失.sql delete mode 100644 resource/sql/薪酬总管理员权限项.sql delete mode 100644 resource/sql/账套新建不了.sql create mode 100644 src/com/engine/salary/mapper/report/SalaryStatisticsItemMapper.java create mode 100644 src/com/engine/salary/mapper/report/SalaryStatisticsItemMapper.xml create mode 100644 src/com/engine/salary/report/service/SubTableExportService.java create mode 100644 src/com/engine/salary/report/service/impl/SubTableExportServiceImpl.java diff --git a/resource/sql/劳务所得.sql b/resource/sql/劳务所得.sql deleted file mode 100644 index 97c8f9ef4..000000000 --- a/resource/sql/劳务所得.sql +++ /dev/null @@ -1,53 +0,0 @@ -INSERT INTO hrsa_sys_salary_item(id, name, code, system_type, category, item_type, use_default, use_in_employee_salary, rounding_mode, pattern, value_type, datasource, formula_id, description, can_edit, can_delete, creator, delete_type, tenant_key, create_time, update_time, data_type) VALUES (700599184238075904, '社保个人合计', 'socialSecurityTotal', 1, 7, 1, 1, 0, 2, 2, 2, 7, 1659339100298, '', 0, 1, 0, 0, 'all_teams', '2022-06-17 09:01:56', '2022-08-01 17:01:24', 'number'); -INSERT INTO hrsa_sys_salary_item(id, name, code, system_type, category, item_type, use_default, use_in_employee_salary, rounding_mode, pattern, value_type, datasource, formula_id, description, can_edit, can_delete, creator, delete_type, tenant_key, create_time, update_time, data_type) VALUES (700599446244319233, '公积金个人合计', 'accumulationFundTotal', 1, 7, 1, 1, 0, 2, 2, 2, 7, 1659339063868, '', 0, 1, 0, 0, 'all_teams', '2022-06-17 09:01:56', '2022-08-01 17:01:26', 'number'); -INSERT INTO hrsa_sys_salary_item(id, name, code, system_type, category, item_type, use_default, use_in_employee_salary, rounding_mode, pattern, value_type, datasource, formula_id, description, can_edit, can_delete, creator, delete_type, tenant_key, create_time, update_time, data_type) VALUES (703458434280095745, '劳务收入', 'laborIncome', 1, 7, 4, 1, 0, 2, 2, 1, 0, 0, '', 1, 1, 0, 0, 'all_teams', '2022-06-17 09:01:56', '2022-08-01 16:55:45', 'number'); -INSERT INTO hrsa_sys_salary_item(id, name, code, system_type, category, item_type, use_default, use_in_employee_salary, rounding_mode, pattern, value_type, datasource, formula_id, description, can_edit, can_delete, creator, delete_type, tenant_key, create_time, update_time, data_type) VALUES (703458558739300353, '劳务免税收入', 'laborTaxFreeIncome', 1, 7, 4, 1, 0, 2, 2, 1, 0, 0, '', 1, 1, 0, 0, 'all_teams', '2022-06-17 09:01:57', '2022-08-01 16:55:54', 'number'); -INSERT INTO hrsa_sys_salary_item(id, name, code, system_type, category, item_type, use_default, use_in_employee_salary, rounding_mode, pattern, value_type, datasource, formula_id, description, can_edit, can_delete, creator, delete_type, tenant_key, create_time, update_time, data_type) VALUES (703459151591383041, '备注', 'description', 1, 7, 1, 1, 0, 2, 2, 1, 0, 0, '', 1, 1, 0, 0, 'all_teams', '2022-06-17 09:01:57', '2022-06-17 09:01:57', 'string'); -INSERT INTO hrsa_sys_salary_item(id, name, code, system_type, category, item_type, use_default, use_in_employee_salary, rounding_mode, pattern, value_type, datasource, formula_id, description, can_edit, can_delete, creator, delete_type, tenant_key, create_time, update_time, data_type) VALUES (703459464954929153, '所得项目', 'incomeItems', 1, 7, 1, 1, 0, 2, 2, 1, 0, 0, '', 1, 1, 0, 0, 'all_teams', '2022-06-17 09:01:57', '2022-06-17 09:01:57', 'string'); -INSERT INTO hrsa_sys_salary_item(id, name, code, system_type, category, item_type, use_default, use_in_employee_salary, rounding_mode, pattern, value_type, datasource, formula_id, description, can_edit, can_delete, creator, delete_type, tenant_key, create_time, update_time, data_type) VALUES (704467747234045953, '劳务税减除费用', 'laborSubtraction', 1, 7, 4, 1, 0, 2, 2, 2, 1, 1659340673739, '', 0, 1, 0, 0, 'all_teams', '2022-06-17 09:01:57', '2022-08-01 17:03:47', 'number'); -INSERT INTO hrsa_sys_salary_item(id, name, code, system_type, category, item_type, use_default, use_in_employee_salary, rounding_mode, pattern, value_type, datasource, formula_id, description, can_edit, can_delete, creator, delete_type, tenant_key, create_time, update_time, data_type) VALUES (704468391612751873, '劳务税应纳税所得额', 'laborTaxableIncome', 1, 7, 4, 1, 0, 2, 2, 2, 1, 1659340916981, '', 0, 1, 0, 0, 'all_teams', '2022-06-17 09:01:58', '2022-08-01 17:03:51', 'number'); -INSERT INTO hrsa_sys_salary_item(id, name, code, system_type, category, item_type, use_default, use_in_employee_salary, rounding_mode, pattern, value_type, datasource, formula_id, description, can_edit, can_delete, creator, delete_type, tenant_key, create_time, update_time, data_type) VALUES (704468443048992769, '劳务税税率', 'laborTaxRate', 1, 7, 4, 1, 0, 2, 2, 2, 1, 1659341397524, '', 0, 1, 0, 0, 'all_teams', '2022-06-17 09:01:58', '2022-08-01 17:03:53', 'number'); -INSERT INTO hrsa_sys_salary_item(id, name, code, system_type, category, item_type, use_default, use_in_employee_salary, rounding_mode, pattern, value_type, datasource, formula_id, description, can_edit, can_delete, creator, delete_type, tenant_key, create_time, update_time, data_type) VALUES (704468490269204481, '劳务税速算扣除数', 'laborQuickDeductionFactor', 1, 7, 4, 1, 0, 2, 2, 2, 1, 1659341564390, '', 0, 1, 0, 0, 'all_teams', '2022-06-17 09:01:58', '2022-08-01 17:03:54', 'number'); -INSERT INTO hrsa_sys_salary_item(id, name, code, system_type, category, item_type, use_default, use_in_employee_salary, rounding_mode, pattern, value_type, datasource, formula_id, description, can_edit, can_delete, creator, delete_type, tenant_key, create_time, update_time, data_type) VALUES (704468528928063488, '劳务税应纳税额', 'laborTaxPayable', 1, 7, 4, 1, 0, 2, 2, 2, 1, 1659341811881, '', 0, 1, 0, 0, 'all_teams', '2022-06-17 09:01:59', '2022-08-01 17:03:55', 'number'); -INSERT INTO hrsa_sys_salary_item(id, name, code, system_type, category, item_type, use_default, use_in_employee_salary, rounding_mode, pattern, value_type, datasource, formula_id, description, can_edit, can_delete, creator, delete_type, tenant_key, create_time, update_time, data_type) VALUES (733975748932845568, '个税调差', 'taxAdjustment', 1, 7, 1, 1, 0, 2, 2, 1, 0, 0, '', 1, 1, 0, 0, 'all_teams', '2022-06-17 09:01:59', '2022-06-17 09:01:59', 'number'); -INSERT INTO hrsa_sys_salary_item(id, name, code, system_type, category, item_type, use_default, use_in_employee_salary, rounding_mode, pattern, value_type, datasource, formula_id, description, can_edit, can_delete, creator, delete_type, tenant_key, create_time, update_time, data_type) VALUES (746777981115629570, '商业健康保险[劳务]', 'commercialHealthInsurance4', 1, 7, 4, 0, 0, 2, 2, 2, 8, 1659341909423, '', 0, 1, 0, 0, 'all_teams', '2022-07-21 14:00:00', '2022-08-01 17:00:38', 'number'); -INSERT INTO hrsa_sys_salary_item(id, name, code, system_type, category, item_type, use_default, use_in_employee_salary, rounding_mode, pattern, value_type, datasource, formula_id, description, can_edit, can_delete, creator, delete_type, tenant_key, create_time, update_time, data_type) VALUES (746777981115629571, '税延养老保险[劳务]', 'taxDeferredEndowmentInsurance4', 1, 7, 4, 0, 0, 2, 2, 2, 8, 1659341966905, '', 0, 1, 0, 0, 'all_teams', '2022-07-21 14:00:00', '2022-08-01 17:00:40', 'number'); -INSERT INTO hrsa_sys_salary_item(id, name, code, system_type, category, item_type, use_default, use_in_employee_salary, rounding_mode, pattern, value_type, datasource, formula_id, description, can_edit, can_delete, creator, delete_type, tenant_key, create_time, update_time, data_type) VALUES (746777981115629572, '其他[劳务]', 'other4', 1, 7, 4, 0, 0, 2, 2, 2, 8, 1659341993723, '', 0, 1, 0, 0, 'all_teams', '2022-07-21 14:00:00', '2022-08-01 17:00:41', 'number'); -INSERT INTO hrsa_sys_salary_item(id, name, code, system_type, category, item_type, use_default, use_in_employee_salary, rounding_mode, pattern, value_type, datasource, formula_id, description, can_edit, can_delete, creator, delete_type, tenant_key, create_time, update_time, data_type) VALUES (746777981115629573, '本月(次)准予扣除的捐赠额[劳务]', 'allowedDonation4', 1, 7, 4, 0, 0, 2, 2, 2, 8, 1659342041963, '', 0, 1, 0, 0, 'all_teams', '2022-07-21 14:00:00', '2022-08-01 17:00:42', 'number'); -INSERT INTO hrsa_sys_salary_item(id, name, code, system_type, category, item_type, use_default, use_in_employee_salary, rounding_mode, pattern, value_type, datasource, formula_id, description, can_edit, can_delete, creator, delete_type, tenant_key, create_time, update_time, data_type) VALUES (746777981115629574, '备注[劳务]', 'description4', 1, 7, 4, 1, 0, 2, 2, 1, 0, 0, '', 1, 1, 0, 0, 'all_teams', '2022-07-21 14:00:00', '2022-08-01 16:56:25', 'string'); -INSERT INTO hrsa_sys_salary_item(id, name, code, system_type, category, item_type, use_default, use_in_employee_salary, rounding_mode, pattern, value_type, datasource, formula_id, description, can_edit, can_delete, creator, delete_type, tenant_key, create_time, update_time, data_type) VALUES (746777981115629575, '已发薪资合计', 'issuedTotal', 1, 7, 1, 0, 0, 2, 2, 1, 0, 0, '', 1, 1, 0, 0, 'all_teams', '2022-07-28 17:26:52', '2022-08-01 16:59:28', 'number'); -INSERT INTO hrsa_sys_salary_item(id, name, code, system_type, category, item_type, use_default, use_in_employee_salary, rounding_mode, pattern, value_type, datasource, formula_id, description, can_edit, can_delete, creator, delete_type, tenant_key, create_time, update_time, data_type) VALUES (746777981115629576, '补发薪资合计', 'ressueTotal', 1, 7, 1, 0, 0, 2, 2, 1, 0, 0, '', 1, 1, 0, 0, 'all_teams', '2022-07-28 17:26:52', '2022-08-01 16:59:40', 'number'); - - -INSERT INTO hrsa_formula(id, name, description, module, use_for, reference_type, return_type, validate_type, extend_param, formula, formulaRunScript, creator, delete_type, create_time, update_time) VALUES (1659339063868, '公式1', '备注', 'salary', 'salaryitem', 'formula', 'number', 'number', '{}', '{社保福利.公积金个人合计}', 'welfare_fundPerSum', 92, 0, '2022-08-01 15:31:04', '2022-08-01 15:31:04'); -INSERT INTO hrsa_formula(id, name, description, module, use_for, reference_type, return_type, validate_type, extend_param, formula, formulaRunScript, creator, delete_type, create_time, update_time) VALUES (1659339100298, '公式1', '备注', 'salary', 'salaryitem', 'formula', 'number', 'number', '{}', '{社保福利.社保个人合计}', 'welfare_socialPerSum', 92, 0, '2022-08-01 15:31:40', '2022-08-01 15:31:40'); -INSERT INTO hrsa_formula(id, name, description, module, use_for, reference_type, return_type, validate_type, extend_param, formula, formulaRunScript, creator, delete_type, create_time, update_time) VALUES (1659340673739, '公式1', '备注', 'salary', 'salaryitem', 'formula', 'number', 'number', '{}', 'if({薪资项目.劳务收入}-{薪资项目.劳务免税收入}<=4000){800;}else{0.2*({薪资项目.劳务收入}-{薪资项目.劳务免税收入})}', 'if(salaryItem_laborIncome-salaryItem_laborTaxFreeIncome<=4000){800;}else{0.2*(salaryItem_laborIncome-salaryItem_laborTaxFreeIncome)}', 92, 0, '2022-08-01 15:57:54', '2022-08-01 15:57:54'); -INSERT INTO hrsa_formula(id, name, description, module, use_for, reference_type, return_type, validate_type, extend_param, formula, formulaRunScript, creator, delete_type, create_time, update_time) VALUES (1659340916981, '公式1', '备注', 'salary', 'salaryitem', 'formula', 'number', 'number', '{}', '{薪资项目.劳务收入}-{薪资项目.劳务免税收入}-{薪资项目.劳务税减除费用}', 'salaryItem_laborIncome-salaryItem_laborTaxFreeIncome-salaryItem_laborSubtraction', 92, 0, '2022-08-01 16:01:57', '2022-08-01 16:01:57'); -INSERT INTO hrsa_formula(id, name, description, module, use_for, reference_type, return_type, validate_type, extend_param, formula, formulaRunScript, creator, delete_type, create_time, update_time) VALUES (1659341397524, '公式1', '备注', 'salary', 'salaryitem', 'formula', 'number', 'number', '{}', 'if({薪资项目.劳务税应纳税所得额}<=20000){0.2;}else if({薪资项目.劳务税应纳税所得额}<=50000){0.3;}else{0.4;}', 'if(salaryItem_laborTaxableIncome<=20000){0.2;}else if(salaryItem_laborTaxableIncome<=50000){0.3;}else{0.4;}', 92, 0, '2022-08-01 16:09:57', '2022-08-01 16:09:57'); -INSERT INTO hrsa_formula(id, name, description, module, use_for, reference_type, return_type, validate_type, extend_param, formula, formulaRunScript, creator, delete_type, create_time, update_time) VALUES (1659341564390, '公式1', '备注', 'salary', 'salaryitem', 'formula', 'number', 'number', '{}', 'if({薪资项目.劳务税应纳税所得额}<=20000){0;}else if({薪资项目.劳务税应纳税所得额}<=50000){2000;}else{7000;}', 'if(salaryItem_laborTaxableIncome<=20000){0;}else if(salaryItem_laborTaxableIncome<=50000){2000;}else{7000;}', 92, 0, '2022-08-01 16:12:44', '2022-08-01 16:12:44'); -INSERT INTO hrsa_formula(id, name, description, module, use_for, reference_type, return_type, validate_type, extend_param, formula, formulaRunScript, creator, delete_type, create_time, update_time) VALUES (1659341811881, '公式1', '备注', 'salary', 'salaryitem', 'formula', 'number', 'number', '{}', 'if({薪资项目.劳务税应纳税所得额}<=0){0;}else{{薪资项目.劳务税应纳税所得额}*{薪资项目.劳务税税率}-{薪资项目.劳务税速算扣除数}}', 'if(salaryItem_laborTaxableIncome<=0){0;}else{salaryItem_laborTaxableIncome*salaryItem_laborTaxRate-salaryItem_laborQuickDeductionFactor}', 92, 0, '2022-08-01 16:16:52', '2022-08-01 16:16:52'); -INSERT INTO hrsa_formula(id, name, description, module, use_for, reference_type, return_type, validate_type, extend_param, formula, formulaRunScript, creator, delete_type, create_time, update_time) VALUES (1659341909423, '公式1', '备注', 'salary', 'salaryitem', 'formula', 'number', 'number', '{}', '{其他免税扣除.商业健康保险}', 'otherDeduction_businessHealthyInsurance', 92, 0, '2022-08-01 16:18:29', '2022-08-01 16:18:29'); -INSERT INTO hrsa_formula(id, name, description, module, use_for, reference_type, return_type, validate_type, extend_param, formula, formulaRunScript, creator, delete_type, create_time, update_time) VALUES (1659341966905, '公式1', '备注', 'salary', 'salaryitem', 'formula', 'number', 'number', '{}', '{其他免税扣除.税延养老保险}', 'otherDeduction_taxDelayEndowmentInsurance', 92, 0, '2022-08-01 16:19:27', '2022-08-01 16:19:27'); -INSERT INTO hrsa_formula(id, name, description, module, use_for, reference_type, return_type, validate_type, extend_param, formula, formulaRunScript, creator, delete_type, create_time, update_time) VALUES (1659341993723, '公式1', '备注', 'salary', 'salaryitem', 'formula', 'number', 'number', '{}', '{其他免税扣除.其他}', 'otherDeduction_otherDeduction', 92, 0, '2022-08-01 16:19:54', '2022-08-01 16:19:54'); -INSERT INTO hrsa_formula(id, name, description, module, use_for, reference_type, return_type, validate_type, extend_param, formula, formulaRunScript, creator, delete_type, create_time, update_time) VALUES (1659342041963, '公式1', '备注', 'salary', 'salaryitem', 'formula', 'number', 'number', '{}', '{其他免税扣除.准予扣除的捐赠额}', 'otherDeduction_deductionAllowedDonation', 92, 0, '2022-08-01 16:20:42', '2022-08-01 16:20:42'); - - - -INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1659339063886, '公积金个人合计', 1659339063868, 'welfare_fundPerSum', '{社保福利.公积金个人合计}', 'number', 'welfare', 1, 92, 0, '2022-08-01 15:31:04', '2022-08-01 15:31:04'); -INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1659339100354, '社保个人合计', 1659339100298, 'welfare_socialPerSum', '{社保福利.社保个人合计}', 'number', 'welfare', 2, 92, 0, '2022-08-01 15:31:40', '2022-08-01 15:31:40'); -INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1659340673751, '劳务收入', 1659340673739, 'salaryItem_laborIncome', '{薪资项目.劳务收入}', 'number', 'salaryItem', 0, 92, 0, '2022-08-01 15:57:54', '2022-08-01 15:57:54'); -INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1659340673754, '劳务免税收入', 1659340673739, 'salaryItem_laborTaxFreeIncome', '{薪资项目.劳务免税收入}', 'number', 'salaryItem', 1, 92, 0, '2022-08-01 15:57:54', '2022-08-01 15:57:54'); -INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1659340917032, '劳务收入', 1659340916981, 'salaryItem_laborIncome', '{薪资项目.劳务收入}', 'number', 'salaryItem', 0, 92, 0, '2022-08-01 16:01:57', '2022-08-01 16:01:57'); -INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1659340917035, '劳务免税收入', 1659340916981, 'salaryItem_laborTaxFreeIncome', '{薪资项目.劳务免税收入}', 'number', 'salaryItem', 1, 92, 0, '2022-08-01 16:01:57', '2022-08-01 16:01:57'); -INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1659340917039, '劳务税减除费用', 1659340916981, 'salaryItem_laborSubtraction', '{薪资项目.劳务税减除费用}', 'number', 'salaryItem', 2, 92, 0, '2022-08-01 16:01:57', '2022-08-01 16:01:57'); -INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1659341397539, '劳务税应纳税所得额', 1659341397524, 'salaryItem_laborTaxableIncome', '{薪资项目.劳务税应纳税所得额}', 'number', 'salaryItem', 0, 92, 0, '2022-08-01 16:09:57', '2022-08-01 16:09:57'); -INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1659341564447, '劳务税应纳税所得额', 1659341564390, 'salaryItem_laborTaxableIncome', '{薪资项目.劳务税应纳税所得额}', 'number', 'salaryItem', 0, 92, 0, '2022-08-01 16:12:44', '2022-08-01 16:12:44'); -INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1659341811897, '劳务税应纳税所得额', 1659341811881, 'salaryItem_laborTaxableIncome', '{薪资项目.劳务税应纳税所得额}', 'number', 'salaryItem', 0, 92, 0, '2022-08-01 16:16:52', '2022-08-01 16:16:52'); -INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1659341811901, '劳务税税率', 1659341811881, 'salaryItem_laborTaxRate', '{薪资项目.劳务税税率}', 'number', 'salaryItem', 3, 92, 0, '2022-08-01 16:16:52', '2022-08-01 16:16:52'); -INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1659341811904, '劳务税速算扣除数', 1659341811881, 'salaryItem_laborQuickDeductionFactor', '{薪资项目.劳务税速算扣除数}', 'number', 'salaryItem', 4, 92, 0, '2022-08-01 16:16:52', '2022-08-01 16:16:52'); -INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1659341909473, '商业健康保险', 1659341909423, 'otherDeduction_businessHealthyInsurance', '{其他免税扣除.商业健康保险}', 'number', 'otherDeduction', 0, 92, 0, '2022-08-01 16:18:29', '2022-08-01 16:18:29'); -INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1659341966920, '税延养老保险', 1659341966905, 'otherDeduction_taxDelayEndowmentInsurance', '{其他免税扣除.税延养老保险}', 'number', 'otherDeduction', 0, 92, 0, '2022-08-01 16:19:27', '2022-08-01 16:19:27'); -INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1659341993736, '其他', 1659341993723, 'otherDeduction_otherDeduction', '{其他免税扣除.其他}', 'number', 'otherDeduction', 0, 92, 0, '2022-08-01 16:19:54', '2022-08-01 16:19:54'); -INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1659342041967, '准予扣除的捐赠额', 1659342041963, 'otherDeduction_deductionAllowedDonation', '{其他免税扣除.准予扣除的捐赠额}', 'number', 'otherDeduction', 0, 92, 0, '2022-08-01 16:20:42', '2022-08-01 16:20:42'); - - diff --git a/resource/sql/新增系统薪资项目.sql b/resource/sql/新增系统薪资项目.sql deleted file mode 100644 index e4de7f957..000000000 --- a/resource/sql/新增系统薪资项目.sql +++ /dev/null @@ -1,22 +0,0 @@ -INSERT INTO hrsa_sys_salary_item(id, name, code, system_type, category, item_type, use_default, use_in_employee_salary, rounding_mode, pattern, value_type, datasource, formula_id, description, can_edit, can_delete, creator, delete_type, tenant_key, create_time, update_time, data_type) VALUES (705641858303836162, '累计婴幼儿照护', 'addUpInfantCare', 1, 7, 1, 1, 0, 2, 2, 2, 0, 1655196897860, '', 0, 1, 0, 0, 'all_teams', '2022-05-31 17:36:04', '2022-05-31 17:36:04', 'number'); -INSERT INTO hrsa_sys_salary_item(id, name, code, system_type, category, item_type, use_default, use_in_employee_salary, rounding_mode, pattern, value_type, datasource, formula_id, description, can_edit, can_delete, creator, delete_type, tenant_key, create_time, update_time, data_type) VALUES (703419929857687552, '当前累计免税收入', 'addUpTaxFreeIncome', 1, 7, 1, 1, 0, 2, 2, 2, 0, 1655197296054, '', 0, 1, 0, 0, 'all_teams', '2022-03-11 13:50:17', '2022-03-17 16:13:27', 'number'); -INSERT INTO hrsa_sys_salary_item(id, name, code, system_type, category, item_type, use_default, use_in_employee_salary, rounding_mode, pattern, value_type, datasource, formula_id, description, can_edit, can_delete, creator, delete_type, tenant_key, create_time, update_time, data_type) VALUES (705641858303836161, '累计大病医疗', 'addUpIllnessMedical', 1, 7, 1, 1, 0, 2, 2, 2, 0, 1655197430967, '', 0, 1, 0, 0, 'all_teams', '2022-03-17 13:30:57', '2022-03-18 17:06:46', 'number'); - - -INSERT INTO hrsa_formula(id, name, description, module, use_for, reference_type, return_type, validate_type, extend_param, formula, formulaRunScript, creator, delete_type, create_time, update_time) VALUES (1655196897860, '公式1', '备注', 'salary', 'salaryitem', 'formula', 'number', 'number', '{}', '{累计专项附加扣除.累计婴幼儿照护}', 'addUpDeductions_addUpInfantCare', 92, 0, '2022-06-14 16:54:58', '2022-06-14 16:54:58'); -INSERT INTO hrsa_formula(id, name, description, module, use_for, reference_type, return_type, validate_type, extend_param, formula, formulaRunScript, creator, delete_type, create_time, update_time) VALUES (1655197296054, '公式1', '备注', 'salary', 'salaryitem', 'formula', 'number', 'number', '{}', '{薪资项目.本月(次)免税收入}+{往期累计情况.累计免税收入}', 'salaryItem_taxFreeIncome+addUpSituation_addUpTaxExemptIncome', 92, 0, '2022-06-14 17:01:36', '2022-06-14 17:01:36'); -INSERT INTO hrsa_formula(id, name, description, module, use_for, reference_type, return_type, validate_type, extend_param, formula, formulaRunScript, creator, delete_type, create_time, update_time) VALUES (1655197430967, '公式1', '备注', 'salary', 'salaryitem', 'formula', 'number', 'number', '{}', '{累计专项附加扣除.累计大病医疗}', 'addUpDeductions_addUpIllnessMedical', 92, 0, '2022-06-14 17:03:51', '2022-06-14 17:03:51'); - - -INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1655196897869, '累计婴幼儿照护', 1655196897860, 'addUpDeductions_addUpInfantCare', '{累计专项附加扣除.累计婴幼儿照护}', 'number', 'addUpDeductions', 0, 92, 0, '2022-06-14 16:54:58', '2022-06-14 16:54:58'); -INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1655197296059, '本月(次)免税收入', 1655197296054, 'salaryItem_taxFreeIncome', '{薪资项目.本月(次)免税收入}', 'number', 'salaryItem', 0, 92, 0, '2022-06-14 17:01:36', '2022-06-14 17:01:36'); -INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1655197296063, '累计免税收入', 1655197296054, 'addUpSituation_addUpTaxExemptIncome', '{往期累计情况.累计免税收入}', 'number', 'addUpSituation', 1, 92, 0, '2022-06-14 17:01:36', '2022-06-14 17:01:36'); -INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1655197430986, '累计大病医疗', 1655197430967, 'addUpDeductions_addUpIllnessMedical', '{累计专项附加扣除.累计大病医疗}', 'number', 'addUpDeductions', 0, 92, 0, '2022-06-14 17:03:51', '2022-06-14 17:03:51'); - - -INSERT INTO hrsa_salary_sob_default_item(id, income_category, sys_salary_item_id, can_edit, can_delete, creator, create_time, update_time, delete_type, tenant_key, sob_default_item_group_id, sorted_index) VALUES (728615865977528321, 1, 705641858303836162, 1, 0, 0, '2022-05-31 17:36:04', '2022-05-31 17:36:04', 0, 'all_teams', 703433961629614103, 7); -INSERT INTO hrsa_salary_sob_default_item(id, income_category, sys_salary_item_id, can_edit, can_delete, creator, create_time, update_time, delete_type, tenant_key, sob_default_item_group_id, sorted_index) VALUES (733975748932845569, 1, 674853617092214787, 1, 1, 0, '2022-06-14 14:52:53', '2022-06-14 14:52:53', 0, 'all_teams', 703433961629614083, 8); -INSERT INTO hrsa_salary_sob_default_item(id, income_category, sys_salary_item_id, can_edit, can_delete, creator, create_time, update_time, delete_type, tenant_key, sob_default_item_group_id, sorted_index) VALUES (733975748932845572, 1, 674853617092214788, 1, 1, 0, '2022-06-14 14:52:53', '2022-06-14 14:52:53', 0, 'all_teams', 703433961629614083, 9); -INSERT INTO hrsa_salary_sob_default_item(id, income_category, sys_salary_item_id, can_edit, can_delete, creator, create_time, update_time, delete_type, tenant_key, sob_default_item_group_id, sorted_index) VALUES (733975748932845578, 1, 674853617092214789, 1, 1, 0, '2022-06-14 14:52:53', '2022-06-14 14:52:53', 0, 'all_teams', 703433961629614083, 10); -INSERT INTO hrsa_salary_sob_default_item(id, income_category, sys_salary_item_id, can_edit, can_delete, creator, create_time, update_time, delete_type, tenant_key, sob_default_item_group_id, sorted_index) VALUES (733975748932845567, 1, 733975748932845568, 1, 1, 0, '2022-06-14 14:52:53', '2022-06-14 14:52:53', 0, 'all_teams', 703433961629614083, 11); - diff --git a/resource/sql/申报表.sql b/resource/sql/申报表.sql deleted file mode 100644 index 8d150edb2..000000000 --- a/resource/sql/申报表.sql +++ /dev/null @@ -1,19 +0,0 @@ -ALTER TABLE hrsa_tax_declaration ADD COLUMN income_category int(255) NOT NULL COMMENT '薪资类型。1:正常工资薪金所得、4:劳务所得' ; - -ALTER TABLE hrsa_tax_declaration_detail ADD COLUMN employee_type int(255) NOT NULL ; - -ALTER TABLE hrsa_tax_declaration ADD income_category int NULL -GO - -ALTER TABLE hrsa_tax_declaration_detail ADD employee_type int NULL -GO - -ALTER TABLE hrsa_tax_declaration add ( - income_category number -) -/ - -ALTER TABLE hrsa_tax_declaration_detail add ( - employee_type number -) -/ \ No newline at end of file diff --git a/resource/sql/申报表字段缺失.sql b/resource/sql/申报表字段缺失.sql deleted file mode 100644 index 7eb4d4a69..000000000 --- a/resource/sql/申报表字段缺失.sql +++ /dev/null @@ -1,81 +0,0 @@ - --- 累计子女教育 -UPDATE a set a.field_value = b.add_up_child_education - FROM hrsa_tax_declaration_detail a,hrsa_add_up_deduction b -where a.employee_id = b.employee_id - and b.tax_agent_id = 4 - and a.tax_declaration_id = 1675151551804 - and a.delete_type = 0 - and b.delete_type =0 - and b.declare_month='2023-01-01 00:00:00' - and a.field_code = 'addUpChildEducation'; - --- 累计住房贷款利息 -UPDATE a set a.field_value = b.add_up_housing_loan_interest - FROM hrsa_tax_declaration_detail a,hrsa_add_up_deduction b -where a.employee_id = b.employee_id - and b.tax_agent_id = 4 - and a.tax_declaration_id = 1675151551804 - and a.delete_type = 0 - and b.delete_type =0 - and b.declare_month='2023-01-01 00:00:00' - and a.field_code = 'addUpHousingLoanInterest'; - --- 累计住房租金 -UPDATE a set a.field_value = b.add_up_housing_rent - FROM hrsa_tax_declaration_detail a,hrsa_add_up_deduction b -where a.employee_id = b.employee_id - and b.tax_agent_id = 4 - and a.tax_declaration_id = 1675151551804 - and a.delete_type = 0 - and b.delete_type =0 - and b.declare_month='2023-01-01 00:00:00' - and a.field_code = 'addUpHousingRent'; - - - --- 累计继续教育 -UPDATE a set a.field_value = b.add_up_continuing_education - FROM hrsa_tax_declaration_detail a,hrsa_add_up_deduction b -where a.employee_id = b.employee_id - and b.tax_agent_id = 4 - and a.tax_declaration_id = 1675151551804 - and a.delete_type = 0 - and b.delete_type =0 - and b.declare_month='2023-01-01 00:00:00' - and a.field_code = 'addUpContinuingEducation'; - ---累计赡养老人 -UPDATE a set a.field_value = b.add_up_support_elderly - FROM hrsa_tax_declaration_detail a,hrsa_add_up_deduction b -where a.employee_id = b.employee_id - and b.tax_agent_id = 4 - and a.tax_declaration_id = 1675151551804 - and a.delete_type = 0 - and b.delete_type =0 - and b.declare_month='2023-01-01 00:00:00' - and a.field_code = 'addUpSupportElderly'; - - - ---累计大病医疗 -UPDATE a set a.field_value = b.add_up_illness_medical - FROM hrsa_tax_declaration_detail a,hrsa_add_up_deduction b -where a.employee_id = b.employee_id - and b.tax_agent_id = 4 - and a.tax_declaration_id = 1675151551804 - and a.delete_type = 0 - and b.delete_type =0 - and b.declare_month='2023-01-01 00:00:00' - and a.field_code = 'addUpIllnessMedical'; - ---累计婴幼儿照护 -UPDATE a set a.field_value = b.add_up_infant_care - FROM hrsa_tax_declaration_detail a,hrsa_add_up_deduction b -where a.employee_id = b.employee_id - and b.tax_agent_id = 4 - and a.tax_declaration_id = 1675151551804 - and a.delete_type = 0 - and b.delete_type =0 - and b.declare_month='2023-01-01 00:00:00' - and a.field_code = 'addUpInfantCare'; \ No newline at end of file diff --git a/resource/sql/薪酬总管理员权限项.sql b/resource/sql/薪酬总管理员权限项.sql deleted file mode 100644 index 899642614..000000000 --- a/resource/sql/薪酬总管理员权限项.sql +++ /dev/null @@ -1,30 +0,0 @@ -delete from SystemRightDetail where rightid =2693 -; -delete from SystemRightsLanguage where id =2693 -; -delete from SystemRights where id =2693 -; -delete from SystemRightToGroup where rightid =2693 -; -delete from SystemRightType where id =36 -; -delete from SystemRightGroups where id =-22 -; -insert into SystemRights (id,rightdesc,righttype,detachable) values (2693,'薪酬管理权限','36',0) -; -insert into SystemRightsLanguage (id,languageid,rightname,rightdesc) values (2693,8,'Salary management authority','Salary management authority') -; -insert into SystemRightsLanguage (id,languageid,rightname,rightdesc) values (2693,9,'薪酬管理權限','薪酬管理權限') -; -insert into SystemRightsLanguage (id,languageid,rightname,rightdesc) values (2693,7,'薪酬管理权限','薪酬管理权限') -; - -insert into SystemRightDetail (id,rightdetailname,rightdetail,rightid) values (43969,'薪酬总管理员','Salary:Chief',2693) -; - -insert into SystemRightToGroup(rightid,groupid) values (2693,-22) -; -insert into SystemRightGroups (id,rightgroupmark, rightgroupname, rightgroupremark) values(-22,'SALARY','薪酬管理权限组','薪酬管理') -; -insert into SystemRightType(id,rightTypeName,rightTypeDesc) VALUES (36,'薪酬管理','薪酬管理') -; diff --git a/resource/sql/账套新建不了.sql b/resource/sql/账套新建不了.sql deleted file mode 100644 index 136519f4f..000000000 --- a/resource/sql/账套新建不了.sql +++ /dev/null @@ -1,9 +0,0 @@ -ALTER TABLE hrsa_salary_item MODIFY COLUMN shared_type int(0) NULL ; -ALTER TABLE hrsa_salary_sob_item MODIFY COLUMN tenant_key varchar(10) null ; - - -ALTER TABLE hrsa_salary_item ALTER COLUMN [shared_type] int NULL -GO - -ALTER TABLE hrsa_salary_sob_item ALTER COLUMN [tenant_key] varchar NULL -GO \ No newline at end of file diff --git a/src/com/engine/salary/mapper/report/SalaryStatisticsItemMapper.java b/src/com/engine/salary/mapper/report/SalaryStatisticsItemMapper.java new file mode 100644 index 000000000..8a7ddab42 --- /dev/null +++ b/src/com/engine/salary/mapper/report/SalaryStatisticsItemMapper.java @@ -0,0 +1,72 @@ +package com.engine.salary.mapper.report; + +import com.engine.salary.report.entity.po.SalaryStatisticsItemPO; +import org.apache.ibatis.annotations.Param; + +import java.util.Collection; +import java.util.List; + +public interface SalaryStatisticsItemMapper { + + /** + * 查询所有记录 + * + * @return 返回集合,没有返回空List + */ + List listAll(); + + /** + * 条件查询 + * + * @return 返回集合,没有返回空List + */ + List listSome(SalaryStatisticsItemPO SalaryStatisticsItemPO); + + + /** + * 根据主键查询 + * + * @param id 主键 + * @return 返回记录,没有返回null + */ + SalaryStatisticsItemPO getById(Long id); + + /** + * 新增,忽略null字段 + * + * @param SalaryStatisticsItemPO 新增的记录 + * @return 返回影响行数 + */ + int insertIgnoreNull(SalaryStatisticsItemPO SalaryStatisticsItemPO); + + /** + * 修改,修改所有字段 + * + * @param SalaryStatisticsItemPO 修改的记录 + * @return 返回影响行数 + */ + int update(SalaryStatisticsItemPO SalaryStatisticsItemPO); + + /** + * 修改,忽略null字段 + * + * @param SalaryStatisticsItemPO 修改的记录 + * @return 返回影响行数 + */ + int updateIgnoreNull(SalaryStatisticsItemPO SalaryStatisticsItemPO); + + /** + * 删除记录 + * + * @param SalaryStatisticsItemPO 待删除的记录 + * @return 返回影响行数 + */ + int delete(SalaryStatisticsItemPO SalaryStatisticsItemPO); + + /** + * 批量删除记录 + * @param ids 主键id集合 + */ + void deleteByIds(@Param("ids") Collection ids); + +} \ No newline at end of file diff --git a/src/com/engine/salary/mapper/report/SalaryStatisticsItemMapper.xml b/src/com/engine/salary/mapper/report/SalaryStatisticsItemMapper.xml new file mode 100644 index 000000000..94fde1d06 --- /dev/null +++ b/src/com/engine/salary/mapper/report/SalaryStatisticsItemMapper.xml @@ -0,0 +1,344 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + t + . + avg_rule + , t.count_rule + , t.create_time + , t.creator + , t.delete_type + , t.id + , t.index_value + , t.item_name + , t.item_value + , t.max_rule + , t.median_rule + , t.min_rule + , t.stat_report_id + , t.sum_rule + , t.tenant_key + , t.unit_type + , t.update_time + + + + + + + + + + + + + + + INSERT INTO hrsa_salary_statistics_item + + + + avg_rule, + + + count_rule, + + + create_time, + + + creator, + + + delete_type, + + + id, + + + index_value, + + + item_name, + + + item_value, + + + max_rule, + + + median_rule, + + + min_rule, + + + stat_report_id, + + + sum_rule, + + + tenant_key, + + + unit_type, + + + update_time, + + + + + #{avgRule}, + + + #{countRule}, + + + #{createTime}, + + + #{creator}, + + + #{deleteType}, + + + #{id}, + + + #{indexValue}, + + + #{itemName}, + + + #{itemValue}, + + + #{maxRule}, + + + #{medianRule}, + + + #{minRule}, + + + #{statReportId}, + + + #{sumRule}, + + + #{tenantKey}, + + + #{unitType}, + + + #{updateTime}, + + + + + + + UPDATE hrsa_salary_statistics_item + + avg_rule=#{avgRule}, + count_rule=#{countRule}, + create_time=#{createTime}, + creator=#{creator}, + delete_type=#{deleteType}, + index_value=#{indexValue}, + item_name=#{itemName}, + item_value=#{itemValue}, + max_rule=#{maxRule}, + median_rule=#{medianRule}, + min_rule=#{minRule}, + stat_report_id=#{statReportId}, + sum_rule=#{sumRule}, + tenant_key=#{tenantKey}, + unit_type=#{unitType}, + update_time=#{updateTime}, + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_salary_statistics_item + + + avg_rule=#{avgRule}, + + + count_rule=#{countRule}, + + + create_time=#{createTime}, + + + creator=#{creator}, + + + delete_type=#{deleteType}, + + + index_value=#{indexValue}, + + + item_name=#{itemName}, + + + item_value=#{itemValue}, + + + max_rule=#{maxRule}, + + + median_rule=#{medianRule}, + + + min_rule=#{minRule}, + + + stat_report_id=#{statReportId}, + + + sum_rule=#{sumRule}, + + + tenant_key=#{tenantKey}, + + + unit_type=#{unitType}, + + + update_time=#{updateTime}, + + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_salary_statistics_item + SET delete_type=1 + WHERE id = #{id} + AND delete_type = 0 + + + + UPDATE hrsa_salary_statistics_item + SET delete_type = 1 + WHERE delete_type = 0 + AND id IN + + #{id} + + + + + \ No newline at end of file diff --git a/src/com/engine/salary/report/entity/bo/SalaryStatisticsReportBO.java b/src/com/engine/salary/report/entity/bo/SalaryStatisticsReportBO.java index 59adc16ad..d4a32742e 100644 --- a/src/com/engine/salary/report/entity/bo/SalaryStatisticsReportBO.java +++ b/src/com/engine/salary/report/entity/bo/SalaryStatisticsReportBO.java @@ -1,6 +1,8 @@ package com.engine.salary.report.entity.bo; import com.alibaba.fastjson.JSON; +import com.cloudstore.eccom.pc.table.WeaTableColumn; +import com.engine.salary.component.WeaTableColumnGroup; import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO; import com.engine.salary.report.common.constant.SalaryStatisticsDimensionConstant; import com.engine.salary.report.entity.dto.SalaryStatisticsItemRuleDTO; @@ -26,6 +28,7 @@ import org.springframework.beans.BeanUtils; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.*; +import java.util.function.Function; import java.util.stream.Collectors; /** @@ -87,17 +90,17 @@ public class SalaryStatisticsReportBO { param.setSalaryEndMonth(ReportTimeUtil.getFormatYearMonth(po.getSalaryEndMonth())); // todo 待优化 - String key = "id"; - param.setTaxAgent(JSON.parseArray(po.getTaxAgentSetting(), Map.class).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList())); - param.setIncomeCategory(JSON.parseArray(po.getIncomeCategorySetting(), Map.class).stream().map(m -> Integer.valueOf(m.get(key).toString())).collect(Collectors.toList())); - param.setSubCompany(JSON.parseArray(po.getSubCompanySetting(), Map.class).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList())); - param.setDepart(JSON.parseArray(po.getDepartSetting(), Map.class).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList())); - param.setGrade(JSON.parseArray(po.getGradeSetting(), Map.class).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList())); - param.setPosition(JSON.parseArray(po.getPositionSetting(), Map.class).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList())); - param.setStatus(JSON.parseArray(po.getStatusSetting(), Map.class).stream().map(m -> m.get(key).toString()).collect(Collectors.toList())); - param.setEmployee(JSON.parseArray(po.getEmployeeSetting(), Map.class).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList())); - param.setHiredate(JSON.parseArray(po.getHiredateSetting(), LocalDate.class)); - param.setLeavedate(JSON.parseArray(po.getLeavedateSetting(), LocalDate.class)); +// String key = "id"; +// param.setTaxAgent(JSON.parseArray(po.getTaxAgentSetting(), Map.class).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList())); +// param.setIncomeCategory(JSON.parseArray(po.getIncomeCategorySetting(), Map.class).stream().map(m -> Integer.valueOf(m.get(key).toString())).collect(Collectors.toList())); +// param.setSubCompany(JSON.parseArray(po.getSubCompanySetting(), Map.class).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList())); +// param.setDepart(JSON.parseArray(po.getDepartSetting(), Map.class).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList())); +// param.setGrade(JSON.parseArray(po.getGradeSetting(), Map.class).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList())); +// param.setPosition(JSON.parseArray(po.getPositionSetting(), Map.class).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList())); +// param.setStatus(JSON.parseArray(po.getStatusSetting(), Map.class).stream().map(m -> m.get(key).toString()).collect(Collectors.toList())); +// param.setEmployee(JSON.parseArray(po.getEmployeeSetting(), Map.class).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList())); +// param.setHiredate(JSON.parseArray(po.getHiredateSetting(), LocalDate.class)); +// param.setLeavedate(JSON.parseArray(po.getLeavedateSetting(), LocalDate.class)); } /** @@ -114,15 +117,15 @@ public class SalaryStatisticsReportBO { if (SalaryStatisticsDimensionConstant.DM_SALARY_MONTH.equals(dimension.getDimCode())) { lastParam.setSalaryStartMonth(ReportTimeUtil.getLastYearMonth(param.getSalaryStartMonth())); lastParam.setSalaryEndMonth(ReportTimeUtil.getLastYearMonth(param.getSalaryEndMonth())); - // 年份 + // 年份 } else if (SalaryStatisticsDimensionConstant.DM_YEAR.equals(dimension.getDimCode())) { lastParam.setSalaryStartMonth(ReportTimeUtil.getSameYearMonth(param.getSalaryStartMonth())); lastParam.setSalaryEndMonth(ReportTimeUtil.getSameYearMonth(param.getSalaryEndMonth())); - // 半年度 + // 半年度 } else if (SalaryStatisticsDimensionConstant.DM_HALF_YEAR.equals(dimension.getDimCode())) { lastParam.setSalaryStartMonth(ReportTimeUtil.getPlusYearMonth(param.getSalaryStartMonth(), -6)); lastParam.setSalaryEndMonth(ReportTimeUtil.getPlusYearMonth(param.getSalaryEndMonth(), -6)); - // 季度 + // 季度 } else if (SalaryStatisticsDimensionConstant.DM_QUARTER.equals(dimension.getDimCode())) { lastParam.setSalaryStartMonth(ReportTimeUtil.getPlusYearMonth(param.getSalaryStartMonth(), -3)); lastParam.setSalaryEndMonth(ReportTimeUtil.getPlusYearMonth(param.getSalaryEndMonth(), -3)); @@ -199,7 +202,6 @@ public class SalaryStatisticsReportBO { } - private static void calculate4Sum(Map result, SalaryStatisticsItemPO item, List> nowDetail, List> lastDetail, List> sameDetail) { SalaryStatisticsItemRuleDTO sumRule = JSON.parseObject(item.getSumRule(), SalaryStatisticsItemRuleDTO.class); if (sumRule == null || sumRule.getTotalValue() != 1) { @@ -487,7 +489,7 @@ public class SalaryStatisticsReportBO { * @param sumDecimal */ private static void nowAndRatio(Map result, SalaryStatisticsItemPO item, SalaryStatisticsItemRuleDTO rule, String ruleKey, BigDecimal sumDecimal) { - String keyPrefix = item.getId().toString() + UD +ruleKey; + String keyPrefix = item.getId().toString() + UD + ruleKey; // 本期合计 result.put(keyPrefix + K_NOW, ReportDataUtil.thousandthConvert(unitTypeConvert(sumDecimal, item.getUnitType()))); // 占比:和本期合计一样的值,便于计算 @@ -507,7 +509,7 @@ public class SalaryStatisticsReportBO { * @param lastValue */ private static void lastM2m(Map result, SalaryStatisticsItemPO item, SalaryStatisticsItemRuleDTO rule, String ruleKey, BigDecimal nowValue, BigDecimal lastValue) { - String keyPrefix = item.getId().toString() + UD +ruleKey; + String keyPrefix = item.getId().toString() + UD + ruleKey; // 上期合计 result.put(keyPrefix + P_LAST, ReportDataUtil.thousandthConvert(unitTypeConvert(lastValue, item.getUnitType()))); // 合计环比差值 @@ -531,7 +533,7 @@ public class SalaryStatisticsReportBO { * @param sameValue */ private static void sameY2y(Map result, SalaryStatisticsItemPO item, SalaryStatisticsItemRuleDTO rule, String ruleKey, BigDecimal nowValue, BigDecimal sameValue) { - String keyPrefix = item.getId().toString() + UD +ruleKey; + String keyPrefix = item.getId().toString() + UD + ruleKey; // 同期合计 result.put(keyPrefix + P_SAME, ReportDataUtil.thousandthConvert(unitTypeConvert(sameValue, item.getUnitType()))); // 合计同比差值 @@ -551,7 +553,7 @@ public class SalaryStatisticsReportBO { * @return */ public static BigDecimal max(List list) { - if(CollectionUtils.isEmpty(list)) return new BigDecimal(D_ZERO); + if (CollectionUtils.isEmpty(list)) return new BigDecimal(D_ZERO); // BigDecimal max = Collections.max(list); BigDecimal sum = list.get(0); @@ -568,7 +570,7 @@ public class SalaryStatisticsReportBO { * @return */ public static BigDecimal min(List list) { - if(CollectionUtils.isEmpty(list)) return new BigDecimal(D_ZERO); + if (CollectionUtils.isEmpty(list)) return new BigDecimal(D_ZERO); // BigDecimal min = Collections.min(list); BigDecimal sum = list.get(0); for (int i = 1; i < list.size(); i++) { @@ -584,13 +586,13 @@ public class SalaryStatisticsReportBO { * @return */ public static BigDecimal median(List list) { - if(CollectionUtils.isEmpty(list)) return new BigDecimal(D_ZERO); + if (CollectionUtils.isEmpty(list)) return new BigDecimal(D_ZERO); Collections.sort(list); int size = list.size(); if (size % 2 == 1) { return list.get((size - 1) / 2); } else { - return (list.get(size/2-1).add(list.get(size/2))).divide(new BigDecimal(2), 2, RoundingMode.HALF_UP); + return (list.get(size / 2 - 1).add(list.get(size / 2))).divide(new BigDecimal(2), 2, RoundingMode.HALF_UP); } } @@ -621,9 +623,10 @@ public class SalaryStatisticsReportBO { /** * 定量-组距式分组list分割 * 说明: - * 1.如果是年:每个人的年份值在这个区间内;如果没有所属字段:各个字段值在区间内;如果有所属字敦:则该所属字段在区间内的数据 - * 2.区间内的话,就把id搞出来 - * 3.符合id的list筛选出来返回 + * 1.如果是年:每个人的年份值在这个区间内;如果没有所属字段:各个字段值在区间内;如果有所属字敦:则该所属字段在区间内的数据 + * 2.区间内的话,就把id搞出来 + * 3.符合id的list筛选出来返回 + * * @param groupSpacing * @param groupBelong * @param dimCode @@ -738,24 +741,23 @@ public class SalaryStatisticsReportBO { * @param page * @param salaryStatisticsItemList * @param employeeId - * @param tenantKey */ - public static Map buildTotal(PageInfo> page, List salaryStatisticsItemList, Long employeeId, String tenantKey) { + public static Map buildTotal(PageInfo> page, List salaryStatisticsItemList, Long employeeId) { Map salaryStatisticsItemMap = SalaryEntityUtil.convert2Map(salaryStatisticsItemList, k -> k.getId() + "-" + employeeId); List> records = page.getList(); if (CollectionUtils.isNotEmpty(records)) { Set keys = records.get(0).keySet(); Map map = new HashMap<>(); - map.put("dimension", SalaryI18nUtil.getI18nLabel( 93278, "合计")); + map.put("dimension", SalaryI18nUtil.getI18nLabel(93278, "合计")); Map itemPOMap = new HashMap<>(); keys.forEach(key -> { - if (key.contains(COUNT+K_NOW) || key.contains(COUNT+K_LAST) || key.contains(COUNT+K_SAME) - || key.contains(SUM+K_NOW) || key.contains(SUM+K_LAST) || key.contains(SUM+K_SAME) - || key.contains(AVG+K_NOW) || key.contains(AVG+K_LAST) || key.contains(AVG+K_SAME) - || key.contains(MAX+K_NOW) || key.contains(MAX+K_LAST) || key.contains(MAX+K_SAME) - || key.contains(MIN+K_NOW) || key.contains(MIN+K_LAST) || key.contains(MIN+K_SAME) - || key.contains(MEDIAN+K_NOW) || key.contains(MEDIAN+K_LAST) || key.contains(MEDIAN+K_SAME)) { + if (key.contains(COUNT + K_NOW) || key.contains(COUNT + K_LAST) || key.contains(COUNT + K_SAME) + || key.contains(SUM + K_NOW) || key.contains(SUM + K_LAST) || key.contains(SUM + K_SAME) + || key.contains(AVG + K_NOW) || key.contains(AVG + K_LAST) || key.contains(AVG + K_SAME) + || key.contains(MAX + K_NOW) || key.contains(MAX + K_LAST) || key.contains(MAX + K_SAME) + || key.contains(MIN + K_NOW) || key.contains(MIN + K_LAST) || key.contains(MIN + K_SAME) + || key.contains(MEDIAN + K_NOW) || key.contains(MEDIAN + K_LAST) || key.contains(MEDIAN + K_SAME)) { String keyStr = key.split(UD)[0]; SalaryStatisticsItemPO salaryStatisticsItem = salaryStatisticsItemMap.get(Long.valueOf(keyStr) + "-" + employeeId); itemPOMap.put(salaryStatisticsItem.getId(), salaryStatisticsItem); @@ -824,139 +826,140 @@ public class SalaryStatisticsReportBO { * @param tenantKey * @return */ -// public static List buildReportColumns(String dimensionName, List salaryStatisticsItemList, Long employeeId, String tenantKey) { -// List result = new ArrayList<>(); -// result.add(new SubTableRankColumn(dimensionName, "dimension", "150", null, null, WeaAlignEnum.CENTER.getStringVal(), "left")); -// Map itemMap = salaryStatisticsItemList.stream().collect(Collectors.toMap(SalaryStatisticsItemPO::getId, Function.identity())); -// Map itemIdNameMap = salaryStatisticsItemList.stream().collect(LinkedHashMap::new, (map, item) -> map.put(item.getId(), item.getItemName()), LinkedHashMap::putAll); -// itemIdNameMap.forEach((k, v) -> { -// SubTableRankColumn weaTableColumn = new SubTableRankColumn(v, k.toString(), "300", null, null, WeaAlignEnum.CENTER.getStringVal()); -// SalaryStatisticsItemPO itemPO = itemMap.get(k); -// List children = new ArrayList<>(); -// // 1.合计规则children -// SalaryStatisticsItemRuleDTO countRule = JSON.parseObject(itemPO.getCountRule(), SalaryStatisticsItemRuleDTO.class); -// if (countRule != null && 1 == countRule.getTotalValue()) { -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 157127, "本周期(计数)"), k + UD + COUNT + P_NOW, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// } -// if (countRule != null && 1 == countRule.getRatioValue()) { -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174288, "本周期占比(计数)"), k + UD + COUNT + P_RATIO, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// } -// if (countRule != null && 1 == countRule.getM2mValue()) { -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 157128, "上周期(计数)"), k + UD + COUNT + P_LAST, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 157129, "计数环比差值"), k + UD + COUNT + P_M2M_D_VALUE, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 157130, "计数环比增幅"), k + UD + COUNT + P_M2M_INCREASE, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// } -// if (countRule != null && 1 == countRule.getY2yValue()) { -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 180672, "同比周期(计数)"), k + UD + COUNT + P_SAME, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174391, "计数同比差值"), k + UD + COUNT + P_Y2Y_D_VALUE, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174392, "计数同比增幅"), k + UD + COUNT + P_Y2Y_INCREASE, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// } -// // 2.求和规则children -// SalaryStatisticsItemRuleDTO totalRule = JSON.parseObject(itemPO.getSumRule(), SalaryStatisticsItemRuleDTO.class); -// if (totalRule != null && 1 == totalRule.getTotalValue()) { -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 157145, "本周期(求和)"), k + UD + SUM + P_NOW, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// } -// if (totalRule != null && 1 == totalRule.getRatioValue()) { -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174289, "本周期占比(求和)"), k + UD + SUM + P_RATIO, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// } -// if (totalRule != null && 1 == totalRule.getM2mValue()) { -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 157146, "上周期(求和)"), k + UD + SUM + P_LAST, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 157147, "求和环比差值"), k + UD + SUM + P_M2M_D_VALUE, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 157148, "求和环比增幅"), k + UD + SUM + P_M2M_INCREASE, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// } -// if (totalRule != null && 1 == totalRule.getY2yValue()) { -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 180673, "同比周期(求和)"), k + UD + SUM + P_SAME, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174388, "求和同比差值"), k + UD + SUM + P_Y2Y_D_VALUE, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174389, "求和同比增幅"), k + UD + SUM + P_Y2Y_INCREASE, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// } -// // 3.平均值规则children -// SalaryStatisticsItemRuleDTO avgRule = JSON.parseObject(itemPO.getAvgRule(), SalaryStatisticsItemRuleDTO.class); -// if (avgRule != null && 1 == avgRule.getTotalValue()) { -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174258, "本周期(平均值)"), k + UD + AVG + P_NOW, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// } -// if (avgRule != null && 1 == avgRule.getRatioValue()) { -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174290, "本周期占比(平均值)"), k + UD + AVG + P_RATIO, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// } -// if (avgRule != null && 1 == avgRule.getM2mValue()) { -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174257, "上周期(平均值)"), k + UD + AVG + P_LAST, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174256, "平均值环比差值"), k + UD + AVG + P_M2M_D_VALUE, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174255, "平均值环比增幅"), k + UD + AVG + P_M2M_INCREASE, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// } -// if (avgRule != null && 1 == avgRule.getY2yValue()) { -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 180674, "同比周期(平均值)"), k + UD + AVG + P_SAME, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174385, "平均值同比差值"), k + UD + AVG + P_Y2Y_D_VALUE, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174386, "平均值同比增幅"), k + UD + AVG + P_Y2Y_INCREASE, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// } -// // 4.最大值规则children -// SalaryStatisticsItemRuleDTO maxRule = JSON.parseObject(itemPO.getMaxRule(), SalaryStatisticsItemRuleDTO.class); -// if (maxRule != null && 1 == maxRule.getTotalValue()) { -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174254, "本周期(最大值)"), k + UD + MAX + P_NOW, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// } -// if (maxRule != null && 1 == maxRule.getRatioValue()) { -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174291, "本周期占比(最大值)"), k + UD + MAX + P_RATIO, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// } -// if (maxRule != null && 1 == maxRule.getM2mValue()) { -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174253, "上周期(最大值)"), k + UD + MAX + P_LAST, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174252, "最大值环比差值"), k + UD + MAX + P_M2M_D_VALUE, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174251, "最大值环比增幅"), k + UD + MAX + P_M2M_INCREASE, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// } -// if (maxRule != null && 1 == maxRule.getY2yValue()) { -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 180675, "同比周期(最大值)"), k + UD + MAX + P_SAME, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174382, "最大值同比差值"), k + UD + MAX + P_Y2Y_D_VALUE, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174383, "最大值同比增幅"), k + UD + MAX + P_Y2Y_INCREASE, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// } -// // 5.最小值规则children -// SalaryStatisticsItemRuleDTO minRule = JSON.parseObject(itemPO.getMinRule(), SalaryStatisticsItemRuleDTO.class); -// if (minRule != null && 1 == minRule.getTotalValue()) { -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174250, "本周期(最小值)"), k + UD + MIN + P_NOW, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// } -// if (minRule != null && 1 == minRule.getRatioValue()) { -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174292, "本周期占比(最小值)"), k + UD + MIN + P_RATIO, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// } -// if (minRule != null && 1 == minRule.getM2mValue()) { -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174249, "上周期(最小值)"), k + UD + MIN + P_LAST, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174248, "最小值环比差值"), k + UD + MIN + P_M2M_D_VALUE, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174247, "最小值环比增幅"), k + UD + MIN + P_M2M_INCREASE, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// } -// if (minRule != null && 1 == minRule.getY2yValue()) { -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 180676, "同比周期(最小值)"), k + UD + MIN + P_SAME, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174379, "最小值同比差值"), k + UD + MIN + P_Y2Y_D_VALUE, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174380, "最小值同比增幅"), k + UD + MIN + P_Y2Y_INCREASE, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// } -// // 6.中位数规则children -// SalaryStatisticsItemRuleDTO medianRule = JSON.parseObject(itemPO.getMedianRule(), SalaryStatisticsItemRuleDTO.class); -// if (medianRule != null && 1 == medianRule.getTotalValue()) { -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174246, "本周期(中位数)"),k + UD + MEDIAN + P_NOW, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// } -// if (medianRule != null && 1 == medianRule.getRatioValue()) { -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174293, "本周期占比(中位数)"), k + UD + MEDIAN + P_RATIO, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// } -// if (medianRule != null && 1 == medianRule.getM2mValue()) { -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174245, "上周期(中位数)"), k + UD + MEDIAN + P_LAST, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174244, "中位数环比差值"), k + UD + MEDIAN + P_M2M_D_VALUE, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174243, "中位数环比增幅"), k + UD + MEDIAN + P_M2M_INCREASE, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// } -// if (medianRule != null && 1 == medianRule.getY2yValue()) { -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 180677, "同比周期(中位数)"), k + UD + MEDIAN + P_SAME, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174376, "中位数同比差值"), k + UD + MEDIAN + P_Y2Y_D_VALUE, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// children.add(new SubTableRankColumn(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 174377, "中位数同比增幅"), k + UD + MEDIAN + P_Y2Y_INCREASE, COL_WIDTH, null, null, WeaAlignEnum.CENTER.getStringVal())); -// } -// weaTableColumn.setChildren(children); -// result.add(weaTableColumn); -// }); -// return result; -// } + 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())); + Map itemIdNameMap = salaryStatisticsItemList.stream().collect(LinkedHashMap::new, (map, item) -> map.put(item.getId(), item.getItemName()), LinkedHashMap::putAll); + itemIdNameMap.forEach((k, v) -> { + WeaTableColumnGroup weaTableColumn = new WeaTableColumnGroup("300", k.toString(), v); + SalaryStatisticsItemPO itemPO = itemMap.get(k); + List children = new ArrayList<>(); + // 1.合计规则children + SalaryStatisticsItemRuleDTO countRule = JSON.parseObject(itemPO.getCountRule(), SalaryStatisticsItemRuleDTO.class); + if (countRule != null && 1 == countRule.getTotalValue()) { + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(157127, "本周期(计数)"), k + UD + COUNT + P_NOW)); + } + if (countRule != null && 1 == countRule.getRatioValue()) { + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174288, "本周期占比(计数)"), k + UD + COUNT + P_RATIO)); + } + if (countRule != null && 1 == countRule.getM2mValue()) { + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(157128, "上周期(计数)"), k + UD + COUNT + P_LAST)); + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(157129, "计数环比差值"), k + UD + COUNT + P_M2M_D_VALUE)); + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(157130, "计数环比增幅"), k + UD + COUNT + P_M2M_INCREASE)); + } + if (countRule != null && 1 == countRule.getY2yValue()) { + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(180672, "同比周期(计数)"), k + UD + COUNT + P_SAME)); + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174391, "计数同比差值"), k + UD + COUNT + P_Y2Y_D_VALUE)); + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174392, "计数同比增幅"), k + UD + COUNT + P_Y2Y_INCREASE)); + } + // 2.求和规则children + SalaryStatisticsItemRuleDTO totalRule = JSON.parseObject(itemPO.getSumRule(), SalaryStatisticsItemRuleDTO.class); + if (totalRule != null && 1 == totalRule.getTotalValue()) { + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(157145, "本周期(求和)"), k + UD + SUM + P_NOW)); + } + if (totalRule != null && 1 == totalRule.getRatioValue()) { + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174289, "本周期占比(求和)"), k + UD + SUM + P_RATIO)); + } + if (totalRule != null && 1 == totalRule.getM2mValue()) { + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(157146, "上周期(求和)"), k + UD + SUM + P_LAST)); + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(157147, "求和环比差值"), k + UD + SUM + P_M2M_D_VALUE)); + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(157148, "求和环比增幅"), k + UD + SUM + P_M2M_INCREASE)); + } + if (totalRule != null && 1 == totalRule.getY2yValue()) { + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(180673, "同比周期(求和)"), k + UD + SUM + P_SAME)); + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174388, "求和同比差值"), k + UD + SUM + P_Y2Y_D_VALUE)); + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174389, "求和同比增幅"), k + UD + SUM + P_Y2Y_INCREASE)); + } + // 3.平均值规则children + SalaryStatisticsItemRuleDTO avgRule = JSON.parseObject(itemPO.getAvgRule(), SalaryStatisticsItemRuleDTO.class); + if (avgRule != null && 1 == avgRule.getTotalValue()) { + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174258, "本周期(平均值)"), k + UD + AVG + P_NOW)); + } + if (avgRule != null && 1 == avgRule.getRatioValue()) { + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174290, "本周期占比(平均值)"), k + UD + AVG + P_RATIO)); + } + if (avgRule != null && 1 == avgRule.getM2mValue()) { + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174257, "上周期(平均值)"), k + UD + AVG + P_LAST)); + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174256, "平均值环比差值"), k + UD + AVG + P_M2M_D_VALUE)); + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174255, "平均值环比增幅"), k + UD + AVG + P_M2M_INCREASE)); + } + if (avgRule != null && 1 == avgRule.getY2yValue()) { + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(180674, "同比周期(平均值)"), k + UD + AVG + P_SAME)); + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174385, "平均值同比差值"), k + UD + AVG + P_Y2Y_D_VALUE)); + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174386, "平均值同比增幅"), k + UD + AVG + P_Y2Y_INCREASE)); + } + // 4.最大值规则children + SalaryStatisticsItemRuleDTO maxRule = JSON.parseObject(itemPO.getMaxRule(), SalaryStatisticsItemRuleDTO.class); + if (maxRule != null && 1 == maxRule.getTotalValue()) { + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174254, "本周期(最大值)"), k + UD + MAX + P_NOW)); + } + if (maxRule != null && 1 == maxRule.getRatioValue()) { + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174291, "本周期占比(最大值)"), k + UD + MAX + P_RATIO)); + } + if (maxRule != null && 1 == maxRule.getM2mValue()) { + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174253, "上周期(最大值)"), k + UD + MAX + P_LAST)); + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174252, "最大值环比差值"), k + UD + MAX + P_M2M_D_VALUE)); + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174251, "最大值环比增幅"), k + UD + MAX + P_M2M_INCREASE)); + } + if (maxRule != null && 1 == maxRule.getY2yValue()) { + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(180675, "同比周期(最大值)"), k + UD + MAX + P_SAME)); + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174382, "最大值同比差值"), k + UD + MAX + P_Y2Y_D_VALUE)); + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174383, "最大值同比增幅"), k + UD + MAX + P_Y2Y_INCREASE)); + } + // 5.最小值规则children + SalaryStatisticsItemRuleDTO minRule = JSON.parseObject(itemPO.getMinRule(), SalaryStatisticsItemRuleDTO.class); + if (minRule != null && 1 == minRule.getTotalValue()) { + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174250, "本周期(最小值)"), k + UD + MIN + P_NOW)); + } + if (minRule != null && 1 == minRule.getRatioValue()) { + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174292, "本周期占比(最小值)"), k + UD + MIN + P_RATIO)); + } + if (minRule != null && 1 == minRule.getM2mValue()) { + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174249, "上周期(最小值)"), k + UD + MIN + P_LAST)); + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174248, "最小值环比差值"), k + UD + MIN + P_M2M_D_VALUE)); + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174247, "最小值环比增幅"), k + UD + MIN + P_M2M_INCREASE)); + } + if (minRule != null && 1 == minRule.getY2yValue()) { + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(180676, "同比周期(最小值)"), k + UD + MIN + P_SAME)); + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174379, "最小值同比差值"), k + UD + MIN + P_Y2Y_D_VALUE)); + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174380, "最小值同比增幅"), k + UD + MIN + P_Y2Y_INCREASE)); + } + // 6.中位数规则children + SalaryStatisticsItemRuleDTO medianRule = JSON.parseObject(itemPO.getMedianRule(), SalaryStatisticsItemRuleDTO.class); + if (medianRule != null && 1 == medianRule.getTotalValue()) { + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174246, "本周期(中位数)"), k + UD + MEDIAN + P_NOW)); + } + if (medianRule != null && 1 == medianRule.getRatioValue()) { + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174293, "本周期占比(中位数)"), k + UD + MEDIAN + P_RATIO)); + } + if (medianRule != null && 1 == medianRule.getM2mValue()) { + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174245, "上周期(中位数)"), k + UD + MEDIAN + P_LAST)); + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174244, "中位数环比差值"), k + UD + MEDIAN + P_M2M_D_VALUE)); + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174243, "中位数环比增幅"), k + UD + MEDIAN + P_M2M_INCREASE)); + } + if (medianRule != null && 1 == medianRule.getY2yValue()) { + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(180677, "同比周期(中位数)"), k + UD + MEDIAN + P_SAME)); + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174376, "中位数同比差值"), k + UD + MEDIAN + P_Y2Y_D_VALUE)); + children.add(new WeaTableColumnGroup(COL_WIDTH, SalaryI18nUtil.getI18nLabel(174377, "中位数同比增幅"), k + UD + MEDIAN + P_Y2Y_INCREASE)); + } + weaTableColumn.setChildren(children); + result.add(weaTableColumn); + }); + return result; + } // public static ExportCommonParam buildExportParam(String dimName, List weaTableColumns, List> records) { // List columns = com.google.common.collect.Lists.newArrayList(); // weaTableColumns.forEach(column -> { -// SubTableRankColumn subTableRankColumn = (SubTableRankColumn) column; +// WeaTableColumnGroup WeaTableColumnGroup = (WeaTableColumnGroup) column; // ExportColumn exportColumn = new ExportColumn(); -// exportColumn.setKeyIndex(subTableRankColumn.getDataIndex()); -// exportColumn.setValue(subTableRankColumn.getTitle()); -// if (CollectionUtils.isNotEmpty(subTableRankColumn.getChildren())) { +// exportColumn.setKeyIndex(WeaTableColumnGroup.getDataIndex()); +// exportColumn.setValue(WeaTableColumnGroup.getTitle()); +// if (CollectionUtils.isNotEmpty(WeaTableColumnGroup.getChildren())) { // List subColumns = com.google.common.collect.Lists.newArrayList(); -// for (SubTableRankColumn sub : subTableRankColumn.getChildren()) { +// for (WeaTableColumnGroup sub : WeaTableColumnGroup.getChildren()) { // ExportColumn subColumn = new ExportColumn(); // subColumn.setKeyIndex(sub.getDataIndex()); // subColumn.setValue(sub.getTitle()); diff --git a/src/com/engine/salary/report/entity/po/SalaryStatisticsItemPO.java b/src/com/engine/salary/report/entity/po/SalaryStatisticsItemPO.java index ca8b53fc7..f42f74fb2 100644 --- a/src/com/engine/salary/report/entity/po/SalaryStatisticsItemPO.java +++ b/src/com/engine/salary/report/entity/po/SalaryStatisticsItemPO.java @@ -7,7 +7,8 @@ import lombok.Data; import lombok.NoArgsConstructor; import java.io.Serializable; -import java.time.LocalDateTime; +import java.util.Collection; +import java.util.Date; /** * @Description: @@ -144,10 +145,10 @@ public class SalaryStatisticsItemPO implements Serializable { private Integer unitType; //创建时间") - private LocalDateTime createTime; + private Date createTime; //更新时间") - private LocalDateTime updateTime; + private Date updateTime; //创建人") private Long creator; @@ -157,4 +158,6 @@ public class SalaryStatisticsItemPO implements Serializable { //租户key") private String tenantKey; + + private Collection ids; } diff --git a/src/com/engine/salary/report/service/SalaryStatisticsReportService.java b/src/com/engine/salary/report/service/SalaryStatisticsReportService.java index ae5f098a1..5e73b95e6 100644 --- a/src/com/engine/salary/report/service/SalaryStatisticsReportService.java +++ b/src/com/engine/salary/report/service/SalaryStatisticsReportService.java @@ -29,8 +29,6 @@ public interface SalaryStatisticsReportService { /** * 获取薪酬报表列表 * - * @param currentEmployeeId - * @param currentTenantKey * @return */ List list(); @@ -39,7 +37,6 @@ public interface SalaryStatisticsReportService { * 获取单个薪酬统计报表 * * @param id - * @param currentTenantKey * @return */ SalaryStatisticsReportPO getById(Long id); @@ -48,8 +45,6 @@ public interface SalaryStatisticsReportService { * 保存薪酬统计报表 * * @param saveParam - * @param currentEmployeeId - * @param currentTenantKey * @return */ String save(SalaryStatisticsReportSaveParam saveParam ); @@ -58,8 +53,6 @@ public interface SalaryStatisticsReportService { * 删除薪酬统计报表 * * @param ids - * @param currentEmployeeId - * @param currentTenantKey * @return */ Map delete(Collection ids ); @@ -80,9 +73,7 @@ public interface SalaryStatisticsReportService { * @param param * @param salaryStatisticsReport * @param salaryStatisticsItemList - * @param employeeId - * @param tenantKey * @return */ - PageInfo> buildReportRecords(SalaryStatisticsDimensionPO dimension, SalaryStatisticsReportDataQueryParam param, SalaryStatisticsReportPO salaryStatisticsReport, List salaryStatisticsItemList, Long employeeId, String tenantKey); + PageInfo> buildReportRecords(SalaryStatisticsDimensionPO dimension, SalaryStatisticsReportDataQueryParam param, SalaryStatisticsReportPO salaryStatisticsReport, List salaryStatisticsItemList); } diff --git a/src/com/engine/salary/report/service/SubTableExportService.java b/src/com/engine/salary/report/service/SubTableExportService.java new file mode 100644 index 000000000..8d084998e --- /dev/null +++ b/src/com/engine/salary/report/service/SubTableExportService.java @@ -0,0 +1,7 @@ +package com.engine.salary.report.service; + +public interface SubTableExportService { + +// Map exportCommon(ExportCommonParam param, User currentUser, String tenantKey); + +} diff --git a/src/com/engine/salary/report/service/impl/SalaryStatisticsItemServiceImpl.java b/src/com/engine/salary/report/service/impl/SalaryStatisticsItemServiceImpl.java index 7c6daeb56..7aeb178b6 100644 --- a/src/com/engine/salary/report/service/impl/SalaryStatisticsItemServiceImpl.java +++ b/src/com/engine/salary/report/service/impl/SalaryStatisticsItemServiceImpl.java @@ -1,32 +1,24 @@ package com.engine.salary.report.service.impl; import com.alibaba.fastjson.JSON; -import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; -import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; import com.engine.core.impl.Service; +import com.engine.salary.constant.SalaryDefaultTenantConstant; +import com.engine.salary.enums.sicategory.DeleteTypeEnum; +import com.engine.salary.exception.SalaryRunTimeException; +import com.engine.salary.mapper.report.SalaryStatisticsItemMapper; +import com.engine.salary.report.entity.param.SalaryStatisticsItemSaveParam; import com.engine.salary.report.entity.po.SalaryStatisticsItemPO; +import com.engine.salary.report.enums.UnitTypeEnum; import com.engine.salary.report.service.SalaryStatisticsItemService; +import com.engine.salary.util.SalaryAssert; import com.engine.salary.util.SalaryI18nUtil; -import com.google.common.base.Joiner; -import com.weaver.common.distribution.genid.IdGenerator; -import com.weaver.common.elog.dto.LoggerContext; -import com.weaver.salary.report.dao.SalaryStatisticsItemMapper; -import com.weaver.salary.report.entity.param.SalaryStatisticsItemSaveParam; -import com.weaver.salary.report.entity.po.SubTablePO; -import com.weaver.salary.report.enums.DeleteTypeEnum; -import com.weaver.salary.report.enums.OperateTypeEnum; -import com.weaver.salary.report.enums.UnitTypeEnum; -import com.weaver.salary.report.exception.SalaryRunTimeException; -import com.weaver.salary.report.util.SalaryAssert; +import dm.jdbc.util.IdGenerator; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang.StringUtils; -import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; -import static com.engine.salary.entity.siaccount.param.DSTenantKeyThreadVar.tenantKey; - /** * @Description: 薪酬报表自定义统计项目 * @Author: wangxiangzhong @@ -34,35 +26,32 @@ import static com.engine.salary.entity.siaccount.param.DSTenantKeyThreadVar.tena */ public class SalaryStatisticsItemServiceImpl extends Service implements SalaryStatisticsItemService { - + private SalaryStatisticsItemMapper salaryStatisticsItemMapper; @Override public SalaryStatisticsItemPO getById(Long id) { - return new LambdaQueryChainWrapper<>(salaryStatisticsItemMapper) - .eq(SalaryStatisticsItemPO::getDeleteType, 0) - .eq(SalaryStatisticsItemPO::getTenantKey, currentTenantKey) - .eq(SalaryStatisticsItemPO::getId, id) - .eq(SalaryStatisticsItemPO::getCreator, currentEmployeeId) - .one(); + if (id == null) { + return null; + } + return salaryStatisticsItemMapper.getById(id); } @Override public List listByStatisticsReportId(Long statisticsReportId) { - return new LambdaQueryChainWrapper<>(salaryStatisticsItemMapper) - .eq(SalaryStatisticsItemPO::getDeleteType, 0) - .eq(SalaryStatisticsItemPO::getTenantKey, currentTenantKey) - .eq(SalaryStatisticsItemPO::getStatReportId, statisticsReportId) - .orderByAsc(SalaryStatisticsItemPO::getIndexValue) - .list(); + if (statisticsReportId == null) { + return null; + } + return salaryStatisticsItemMapper.listSome(SalaryStatisticsItemPO.builder().statReportId(statisticsReportId).build()); } - public List listByIds(Collection ids, String currentTenantKey) { - return new LambdaQueryChainWrapper<>(salaryStatisticsItemMapper) - .eq(SalaryStatisticsItemPO::getDeleteType, 0) - .eq(SalaryStatisticsItemPO::getTenantKey, currentTenantKey) - .in(SalaryStatisticsItemPO::getId, ids) - .list(); + public List listByIds(Collection ids) { + + if (CollectionUtils.isEmpty(ids)) { + return new ArrayList<>(); + } + + return salaryStatisticsItemMapper.listSome(SalaryStatisticsItemPO.builder().ids(ids).build()); } @Override @@ -70,21 +59,16 @@ public class SalaryStatisticsItemServiceImpl extends Service implements SalarySt SalaryAssert.notEmpty(ids, SalaryI18nUtil.getI18nLabel(152638, "id不可为空")); List list = this.listByIds(ids); if (CollectionUtils.isNotEmpty(list)) { - new LambdaUpdateChainWrapper<>(salaryStatisticsItemMapper) - .eq(SalaryStatisticsItemPO::getDeleteType, 0) - .eq(SalaryStatisticsItemPO::getTenantKey) - .in(SalaryStatisticsItemPO::getId, ids) - .set(SalaryStatisticsItemPO::getDeleteType, 1) - .update(); - list.forEach(po -> { - LoggerContext loggerContext = new LoggerContext<>(); - loggerContext.setTargetId(String.valueOf(po.getId())); - loggerContext.setTargetName(po.getItemName()); - loggerContext.setOperateType(OperateTypeEnum.DELETE.getValue()); - loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(152639, "删除统计项目")); - loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(152639, "删除统计项目")); - salaryStatReportLoggerTemplate.write(loggerContext); - }); + salaryStatisticsItemMapper.deleteByIds(ids); +// list.forEach(po -> { +// LoggerContext loggerContext = new LoggerContext<>(); +// loggerContext.setTargetId(String.valueOf(po.getId())); +// loggerContext.setTargetName(po.getItemName()); +// loggerContext.setOperateType(OperateTypeEnum.DELETE.getValue()); +// loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(152639, "删除统计项目")); +// loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(152639, "删除统计项目")); +// salaryStatReportLoggerTemplate.write(loggerContext); +// }); } return StringUtils.EMPTY; } @@ -103,7 +87,7 @@ public class SalaryStatisticsItemServiceImpl extends Service implements SalarySt throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(152641, "统计项名称必填")); } - List itemPOList = listByStatisticsReportId(saveParam.getStatReportId(), employeeId); + List itemPOList = listByStatisticsReportId(saveParam.getStatReportId()); boolean isRepeat = itemPOList.stream().anyMatch(po -> saveParam.getItemName().equals(po.getItemName())); if (isRepeat) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(152642, "统计项目名称已经存在")); @@ -112,12 +96,14 @@ public class SalaryStatisticsItemServiceImpl extends Service implements SalarySt List indexValues = itemPOList.stream().map(SalaryStatisticsItemPO::getIndexValue).collect(Collectors.toList()); Integer max = CollectionUtils.isEmpty(indexValues) ? 1 : Collections.max(indexValues); + Date now = new Date(); + SalaryStatisticsItemPO subTableItemPO = SalaryStatisticsItemPO.builder() .id(IdGenerator.generate()) - .createTime(LocalDateTime.now()) + .createTime(now) .deleteType(DeleteTypeEnum.NOT_DELETED.getValue()) .itemName(saveParam.getItemName()) - .itemValue(Joiner.on(",").join(saveParam.getItemValue())) + .itemValue(StringUtils.join(saveParam.getItemValue(), ",")) .countRule(JSON.toJSONString(saveParam.getCountRule())) .sumRule(JSON.toJSONString(saveParam.getSumRule())) .avgRule(JSON.toJSONString(saveParam.getAvgRule())) @@ -127,30 +113,30 @@ public class SalaryStatisticsItemServiceImpl extends Service implements SalarySt .indexValue(max + 1) .statReportId(saveParam.getStatReportId()) .unitType(saveParam.getUnitType() == null ? UnitTypeEnum.YUAN.getItem() : saveParam.getUnitType()) - .creator(employeeId) - .updateTime(LocalDateTime.now()) - .tenantKey(tenantKey) + .creator((long)user.getUID()) + .updateTime(now) + .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) .build(); - salaryStatisticsItemMapper.insert(subTableItemPO); + salaryStatisticsItemMapper.insertIgnoreNull(subTableItemPO); // 记录操作日志 - LoggerContext loggerContext = new LoggerContext<>(); - loggerContext.setTargetId(String.valueOf(subTableItemPO.getId())); - loggerContext.setTargetName(subTableItemPO.getItemName()); - loggerContext.setOperateType(OperateTypeEnum.ADD.getValue()); - loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(152643, "新增统计项目")); - loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(152643, "新增统计项目")); - salaryStatReportLoggerTemplate.write(loggerContext); - // 更新 +// LoggerContext loggerContext = new LoggerContext<>(); +// loggerContext.setTargetId(String.valueOf(subTableItemPO.getId())); +// loggerContext.setTargetName(subTableItemPO.getItemName()); +// loggerContext.setOperateType(OperateTypeEnum.ADD.getValue()); +// loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(152643, "新增统计项目")); +// loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(152643, "新增统计项目")); +// salaryStatReportLoggerTemplate.write(loggerContext); + // 更新 } else { - SalaryStatisticsItemPO itemPO = this.getById(saveParam.getId(), employeeId); + SalaryStatisticsItemPO itemPO = this.getById(saveParam.getId()); SalaryAssert.notNull(itemPO, SalaryI18nUtil.getI18nLabel(152591, "统计项目不存在")); Optional.ofNullable(saveParam.getItemName()).ifPresent(itemPO::setItemName); if (Objects.nonNull(saveParam.getUnitType())) { itemPO.setUnitType(saveParam.getUnitType()); } else { - itemPO.setItemValue(Joiner.on(",").join(saveParam.getItemValue())); + itemPO.setItemValue(StringUtils.join(saveParam.getItemValue(),",")); itemPO.setCountRule(Objects.nonNull(saveParam.getCountRule()) ? JSON.toJSONString(saveParam.getCountRule()) : ""); itemPO.setSumRule(Objects.nonNull(saveParam.getSumRule()) ? JSON.toJSONString(saveParam.getSumRule()) : ""); itemPO.setAvgRule(Objects.nonNull(saveParam.getAvgRule()) ? JSON.toJSONString(saveParam.getAvgRule()) : ""); @@ -159,16 +145,16 @@ public class SalaryStatisticsItemServiceImpl extends Service implements SalarySt itemPO.setMedianRule(Objects.nonNull(saveParam.getMedianRule()) ? JSON.toJSONString(saveParam.getMedianRule()) : ""); } - salaryStatisticsItemMapper.updateById(itemPO); + salaryStatisticsItemMapper.updateIgnoreNull(itemPO); // 记录操作日志 - LoggerContext loggerContext = new LoggerContext<>(); - loggerContext.setTargetId(String.valueOf(itemPO.getId())); - loggerContext.setTargetName(itemPO.getItemName()); - loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue()); - loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(152669, "更新统计项目")); - loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(152669, "更新统计项目")); - salaryStatReportLoggerTemplate.write(loggerContext); +// LoggerContext loggerContext = new LoggerContext<>(); +// loggerContext.setTargetId(String.valueOf(itemPO.getId())); +// loggerContext.setTargetName(itemPO.getItemName()); +// loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue()); +// loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(152669, "更新统计项目")); +// loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(152669, "更新统计项目")); +// salaryStatReportLoggerTemplate.write(loggerContext); } return StringUtils.EMPTY; } diff --git a/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java b/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java index 43fc9b355..8b0a54444 100644 --- a/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java +++ b/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java @@ -1,63 +1,41 @@ package com.engine.salary.report.service.impl; -import com.alibaba.fastjson.JSON; import com.engine.core.impl.Service; +import com.engine.salary.constant.SalaryDefaultTenantConstant; import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO; +import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO; import com.engine.salary.exception.SalaryRunTimeException; 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.SalaryStatisticsReportDataQueryParam; import com.engine.salary.report.entity.param.SalaryStatisticsReportSaveParam; import com.engine.salary.report.entity.param.SalaryStatisticsSearchConditionSaveParam; import com.engine.salary.report.entity.po.SalaryStatisticsDimensionPO; import com.engine.salary.report.entity.po.SalaryStatisticsItemPO; import com.engine.salary.report.entity.po.SalaryStatisticsReportPO; +import com.engine.salary.report.enums.SalaryStatisticsDimensionTypeEnum; +import com.engine.salary.report.service.SalaryStatisticsItemService; import com.engine.salary.report.service.SalaryStatisticsReportService; import com.engine.salary.service.SalaryAcctEmployeeService; import com.engine.salary.service.SalaryAcctResultService; import com.engine.salary.service.TaxAgentService; -import com.engine.salary.util.SalaryAssert; +import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.page.PageInfo; -import com.google.common.base.Joiner; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; -import com.weaver.common.component.table.page.Page; -import com.weaver.common.elog.util.LoggerTemplate; -import com.weaver.common.hrm.cache.HrmDepartmentComInfo; -import com.weaver.common.hrm.domain.employee.HrmStatus; -import com.weaver.common.hrm.dto.jobcall.HrmJobCallParam; -import com.weaver.common.hrm.entity.BrowserDataDto; -import com.weaver.common.hrm.remote.jobcall.HrmJobCallRemoteService; -import com.weaver.common.hrm.service.HrmCommonEmployeeService; -import com.weaver.common.hrm.service.employee.HrmCommonHrmStatusService; -import com.weaver.framework.rpc.annotation.RpcReference; -import com.weaver.framework.util.JsonUtil; -import com.weaver.salary.report.common.constant.SalaryStatisticsDimensionConstant; -import com.weaver.salary.report.entity.dto.SalaryStatisticsReportDataDTO; -import com.weaver.salary.report.entity.param.SalaryStatisticsDimensionSaveParam; -import com.weaver.salary.report.entity.po.*; -import com.weaver.salary.report.enums.EmployeeTypeEnum; -import com.weaver.salary.report.enums.IncomeCategoryEnum; -import com.weaver.salary.report.enums.SalaryStatisticsDimensionTypeEnum; -import com.weaver.salary.report.service.*; -import com.weaver.salary.report.util.*; -import com.weaver.teams.api.user.Sex; -import com.weaver.teams.domain.hr.SimpleUserInfo; -import com.weaver.teams.domain.user.SimpleEmployee; -import com.weaver.teams.hrapp.rest.RemoteUserInfoService; import dm.jdbc.util.IdGenerator; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; -import javax.annotation.Resource; -import java.time.LocalDateTime; import java.util.*; +import java.util.function.Function; import java.util.stream.Collectors; /** @@ -74,28 +52,28 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary public static final String LAST_INFO = "lastInfoList"; public static final String SAME_INFO = "sameInfoList"; - + private SalaryStatisticsReportMapper salaryStatisticsReportMapper; - + private SalaryStatisticsItemService salaryStatisticsItemService; - + private SalaryAcctEmployeeService salaryAcctEmployeeService; - + private SalaryAcctResultService salaryAcctResultValueService; - + private TaxAgentService taxAgentService; - - private ExtEmployeeService extEmployeeService; - @Autowired - private HrmCommonEmployeeService hrmCommonEmployeeService; - @RpcReference - private HrmJobCallRemoteService hrmJobCallRemoteService; - @RpcReference - private RemoteUserInfoService remoteUserInfoService; - @Autowired - private HrmCommonHrmStatusService hrmCommonHrmStatusService; - (name = "salaryStatReportLoggerTemplate") - private LoggerTemplate salaryStatReportLoggerTemplate; + +// private ExtEmployeeService extEmployeeService; +// @Autowired +// private HrmCommonEmployeeService hrmCommonEmployeeService; +// @RpcReference +// private HrmJobCallRemoteService hrmJobCallRemoteService; +// @RpcReference +// private RemoteUserInfoService remoteUserInfoService; +// @Autowired +// private HrmCommonHrmStatusService hrmCommonHrmStatusService; +// (name = "salaryStatReportLoggerTemplate") +// private LoggerTemplate salaryStatReportLoggerTemplate; @Override public List listAll() { @@ -104,7 +82,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary @Override public List list() { - return salaryStatisticsReportMapper.listSome(SalaryStatisticsReportPO.builder().creator((long)user.getUID()).build()); + return salaryStatisticsReportMapper.listSome(SalaryStatisticsReportPO.builder().creator((long) user.getUID()).build()); } @Override @@ -126,21 +104,21 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary public String save(SalaryStatisticsReportSaveParam saveParam) { SalaryStatisticsReportSaveParam.checkParam(saveParam); - LocalDateTime now = LocalDateTime.now(); + Date now = new Date(); if (saveParam.getId() != null) { SalaryStatisticsReportPO po = this.getById(saveParam.getId()); if (po == null) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel( 161845, "薪酬统计报表不存在")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(161845, "薪酬统计报表不存在")); } - List list = listByName(saveParam.getReportName()); + List list = listByName(saveParam.getReportName()); boolean nameExist = list.stream().anyMatch(e -> !Objects.equals(e.getId(), saveParam.getId())); if (nameExist) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel( 98080, "名称不允许重复")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98080, "名称不允许重复")); } SalaryStatisticsReportPO poNew = new SalaryStatisticsReportPO(); BeanUtils.copyProperties(po, poNew); poNew.setReportName(saveParam.getReportName()); - poNew.setDimension(Joiner.on(",").join(saveParam.getDimensionIds())); + poNew.setDimension(StringUtils.join(saveParam.getDimensionIds(), ",")); this.salaryStatisticsReportMapper.updateIgnoreNull(poNew); // 记录日志 @@ -152,17 +130,17 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary // loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel( 152565, "更新报表")); // salaryStatReportLoggerTemplate.write(loggerContext); } else { - List list = listByName(saveParam.getReportName()); + List list = listByName(saveParam.getReportName()); if (CollectionUtils.isNotEmpty(list)) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel( 98080, "名称不允许重复")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98080, "名称不允许重复")); } Long id = IdGenerator.generate(); SalaryStatisticsReportPO poNew = SalaryStatisticsReportPO.builder() .id(id) .reportName(saveParam.getReportName()) - .dimension(Joiner.on(",").join(saveParam.getDimensionIds())) + .dimension(StringUtils.join(saveParam.getDimensionIds(), ",")) .createTime(now) - .creator(user.getUID()) + .creator((long) user.getUID()) .updateTime(now) .deleteType(0) .tenantKey("") @@ -183,46 +161,46 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary @Override public String saveSearchCondition(SalaryStatisticsSearchConditionSaveParam param) { - SalaryAssert.notNull(param.getId(), SalaryI18nUtil.getI18nLabel(152562, "报表id不能为空")); - if (Objects.isNull(param.getSalaryStartMonth()) || Objects.isNull(param.getSalaryEndMonth())) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100294, "薪资所属月必传")); - } - if ((CollectionUtils.isNotEmpty(param.getTaxAgent()) && param.getTaxAgent().size() > 10) - || (CollectionUtils.isNotEmpty(param.getIncomeCategory()) && param.getIncomeCategory().size() > 10) - || (CollectionUtils.isNotEmpty(param.getSubCompany()) && param.getSubCompany().size() > 10) - || (CollectionUtils.isNotEmpty(param.getGrade()) && param.getGrade().size() > 10) - || (CollectionUtils.isNotEmpty(param.getPosition()) && param.getPosition().size() > 10) - || (CollectionUtils.isNotEmpty(param.getStatus()) && param.getStatus().size() > 10) - || (CollectionUtils.isNotEmpty(param.getEmployee()) && param.getEmployee().size() > 10) - ) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(182014, "统计数据范围条件数量过多")); - } - - SalaryStatisticsReportPO po = getById(param.getId()); - SalaryAssert.notNull(po, SalaryI18nUtil.getI18nLabel(152563, "报表不存在")); - po.setSalaryStartMonth(param.getSalaryStartMonth().atDay(1)); - po.setSalaryEndMonth(param.getSalaryEndMonth().atDay(1)); - - po.setTaxAgentSetting(JSON.toJSONString(param.getTaxAgent())); - po.setIncomeCategorySetting(JSON.toJSONString(param.getIncomeCategory())); - po.setSubCompanySetting(JSON.toJSONString(param.getSubCompany())); - po.setDepartSetting(JSON.toJSONString(param.getDepartment())); - po.setGradeSetting(JSON.toJSONString(param.getGrade())); - po.setPositionSetting(JSON.toJSONString(param.getPosition())); - po.setStatusSetting(JSON.toJSONString(param.getStatus())); - po.setEmployeeSetting(JSON.toJSONString(param.getEmployee())); - po.setHiredateSetting(JSON.toJSONString(param.getHiredate())); - po.setLeavedateSetting(JSON.toJSONString(param.getLeavedate())); - salaryStatisticsReportMapper.updateIgnoreNull(po); - - // 获取自定义统计项目 - List salaryStatisticsItemList = salaryStatisticsItemService.listByStatisticsReportId(po.getId()); - - salaryStatisticsItemList.forEach(e -> param.getItems().stream().filter(i -> i.getId().equals(e.getId())).findFirst().ifPresent(salaryStatisticsItem -> { - e.setUnitType(salaryStatisticsItem.getUnitType()); - e.setIndexValue(salaryStatisticsItem.getIndexValue()); - })); - this.salaryStatisticsItemService.saveOrUpdateBatch(salaryStatisticsItemList); +// SalaryAssert.notNull(param.getId(), SalaryI18nUtil.getI18nLabel(152562, "报表id不能为空")); +// if (Objects.isNull(param.getSalaryStartMonth()) || Objects.isNull(param.getSalaryEndMonth())) { +// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100294, "薪资所属月必传")); +// } +// if ((CollectionUtils.isNotEmpty(param.getTaxAgent()) && param.getTaxAgent().size() > 10) +// || (CollectionUtils.isNotEmpty(param.getIncomeCategory()) && param.getIncomeCategory().size() > 10) +// || (CollectionUtils.isNotEmpty(param.getSubCompany()) && param.getSubCompany().size() > 10) +// || (CollectionUtils.isNotEmpty(param.getGrade()) && param.getGrade().size() > 10) +// || (CollectionUtils.isNotEmpty(param.getPosition()) && param.getPosition().size() > 10) +// || (CollectionUtils.isNotEmpty(param.getStatus()) && param.getStatus().size() > 10) +// || (CollectionUtils.isNotEmpty(param.getEmployee()) && param.getEmployee().size() > 10) +// ) { +// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(182014, "统计数据范围条件数量过多")); +// } +// +// SalaryStatisticsReportPO po = getById(param.getId()); +// SalaryAssert.notNull(po, SalaryI18nUtil.getI18nLabel(152563, "报表不存在")); +// po.setSalaryStartMonth(param.getSalaryStartMonth().atDay(1)); +// po.setSalaryEndMonth(param.getSalaryEndMonth().atDay(1)); +// +// po.setTaxAgentSetting(JSON.toJSONString(param.getTaxAgent())); +// po.setIncomeCategorySetting(JSON.toJSONString(param.getIncomeCategory())); +// po.setSubCompanySetting(JSON.toJSONString(param.getSubCompany())); +// po.setDepartSetting(JSON.toJSONString(param.getDepartment())); +// po.setGradeSetting(JSON.toJSONString(param.getGrade())); +// po.setPositionSetting(JSON.toJSONString(param.getPosition())); +// po.setStatusSetting(JSON.toJSONString(param.getStatus())); +// po.setEmployeeSetting(JSON.toJSONString(param.getEmployee())); +// po.setHiredateSetting(JSON.toJSONString(param.getHiredate())); +// po.setLeavedateSetting(JSON.toJSONString(param.getLeavedate())); +// salaryStatisticsReportMapper.updateIgnoreNull(po); +// +// // 获取自定义统计项目 +// List salaryStatisticsItemList = salaryStatisticsItemService.listByStatisticsReportId(po.getId()); +// +// salaryStatisticsItemList.forEach(e -> param.getItems().stream().filter(i -> i.getId().equals(e.getId())).findFirst().ifPresent(salaryStatisticsItem -> { +// e.setUnitType(salaryStatisticsItem.getUnitType()); +// e.setIndexValue(salaryStatisticsItem.getIndexValue()); +// })); +// this.salaryStatisticsItemService.saveOrUpdateBatch(salaryStatisticsItemList); // 记录日志 // LoggerContext loggerContext = new LoggerContext<>(); @@ -238,13 +216,13 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary @Override public Map delete(Collection ids) { if (CollectionUtils.isEmpty(ids)) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel( 84026, "参数错误")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误")); } int total = ids.size(); List list = salaryStatisticsReportMapper.listSome(SalaryStatisticsReportPO.builder().ids(ids).build()); int success = list.size(); - if (success>0) { + if (success > 0) { List deleteIds = list.stream().map(SalaryStatisticsReportPO::getId).collect(Collectors.toList()); salaryStatisticsReportMapper.deleteByIds(deleteIds); @@ -262,12 +240,12 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary } Map resultMap = new HashMap<>(2); - String resultMsg = SalaryI18nUtil.getI18nLabel( 94620, "操作成功"); + String resultMsg = SalaryI18nUtil.getI18nLabel(94620, "操作成功"); String resultType = "success"; // 单个设为定薪提示 if (total > 1) { - resultMsg = SalaryI18nUtil.getI18nLabel( 134807, "成功条数") + ": "+ (success) + "; " - + SalaryI18nUtil.getI18nLabel( 134808, "失败条数") + ": "+ (total - success); + resultMsg = SalaryI18nUtil.getI18nLabel(134807, "成功条数") + ": " + (success) + "; " + + SalaryI18nUtil.getI18nLabel(134808, "失败条数") + ": " + (total - success); if ((total - success) > 0) { resultType = "info"; } @@ -280,7 +258,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary } @Override - public PageInfo> buildReportRecords(SalaryStatisticsDimensionPO dimension, SalaryStatisticsReportDataQueryParam param, SalaryStatisticsReportPO po, List salaryStatisticsItemList, Long employeeId, String tenantKey) { + public PageInfo> buildReportRecords(SalaryStatisticsDimensionPO dimension, SalaryStatisticsReportDataQueryParam param, SalaryStatisticsReportPO po, List salaryStatisticsItemList) { Map checkMap = SalaryStatisticsReportBO.checkLoad(salaryStatisticsItemList); // 如果一个都没有,直接返回 if (!checkMap.get("isNow")) { @@ -290,21 +268,21 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary SalaryStatisticsReportBO.poToQueryParam(param, po); // 获取本期报表分权后的核算人员 - List list = salaryAcctEmployeeService.listBySalaryStatisticsReportParam(param, employeeId, tenantKey); + List list = salaryAcctEmployeeService.listBySalaryStatisticsReportParam(param); SalaryStatisticsReportDataQueryParam lastParam = SalaryStatisticsReportBO.lastParamConvert(param, dimension); // 获取上期报表分权后的核算人员 - List lastList = checkMap.get("isLast") ? salaryAcctEmployeeService.listBySalaryStatisticsReportParam(lastParam, employeeId, tenantKey) : Lists.newArrayList(); + List lastList = checkMap.get("isLast") ? salaryAcctEmployeeService.listBySalaryStatisticsReportParam(lastParam) : Lists.newArrayList(); SalaryStatisticsReportDataQueryParam sameParam = SalaryStatisticsReportBO.sameParamConvert(param); // 获取去年同期报表分权后的核算人员 - List sameList = checkMap.get("isSame") ? salaryAcctEmployeeService.listBySalaryStatisticsReportParam(sameParam, employeeId, tenantKey) : Lists.newArrayList(); + List sameList = checkMap.get("isSame") ? salaryAcctEmployeeService.listBySalaryStatisticsReportParam(sameParam) : Lists.newArrayList(); SalaryStatisticsReportDataDTO salaryStatisticsReportData = SalaryStatisticsReportDataDTO.builder() .list(list) .lastList(lastList) .sameList(sameList) .salaryStatisticsItemList(salaryStatisticsItemList) - .employeeId(employeeId) - .tenantKey(tenantKey) + .employeeId((long) user.getUID()) + .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) .build(); List allList = Lists.newArrayList(); @@ -312,14 +290,20 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary allList.addAll(lastList); allList.addAll(sameList); Set salaryAcctEmployeeIds = allList.stream().map(SalaryAcctEmployeePO::getId).collect(Collectors.toSet()); - List salaryAcctResultValues = salaryAcctResultValueService.listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds, tenantKey); - Map> salaryAcctResultValueMap = SalaryEntityUtil.convert2Map(salaryAcctResultValues, SalaryAcctResultValuePO::getSalaryAcctEmployeeId, SalaryAcctResultValuePO::getResultValue); + List salaryAcctResultValues = salaryAcctResultValueService.listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds); +// Map> salaryAcctResultValueMap = SalaryEntityUtil.convert2Map(); + Map> salaryAcctEmpResultMap = SalaryEntityUtil.group2Map(salaryAcctResultValues, SalaryAcctResultPO::getSalaryAcctEmpId); + Map> map = new HashMap<>(); + salaryAcctEmpResultMap.forEach((k, v) -> { + Map collect = v.stream().collect(Collectors.toMap(p->p.getSalaryItemId().toString(), SalaryAcctResultPO::getResultValue, (key1, key2) -> key2)); + map.put(k,collect); + }); // 根据统计维度进行计算 - return calculateReportRecordsByDimension(dimension, param, salaryStatisticsReportData, salaryAcctResultValueMap); + return calculateReportRecordsByDimension(dimension, param, salaryStatisticsReportData, map); } - private Page> calculateReportRecordsByDimension(SalaryStatisticsDimensionPO dimension, SalaryStatisticsReportDataQueryParam param, SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { + private PageInfo> calculateReportRecordsByDimension(SalaryStatisticsDimensionPO dimension, SalaryStatisticsReportDataQueryParam param, SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { // 定性 if (SalaryStatisticsDimensionTypeEnum.QUALITATIVE.getValue().equals(dimension.getDimType())) { switch (dimension.getDimCode()) { @@ -376,17 +360,17 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary default: return new Page<>(); } - // 定量-组距式分组 + // 定量-组距式分组 } 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 Page<>(); } - private Page> buildSalaryMonthRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { + private PageInfo> buildSalaryMonthRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { Page> result = new Page<>(); List> records = new ArrayList<>(); Map> listMap = data.getList().stream().collect(Collectors.groupingBy(SalaryAcctEmployeePO::getSalaryMonth)); @@ -403,7 +387,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary return result; } - private Page> buildTaxAgentRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { + private PageInfo> buildTaxAgentRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { Page> result = new Page<>(); List> records = new ArrayList<>(); @@ -425,7 +409,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary return result; } - private Page> buildIncomeCategoryRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { + private PageInfo> buildIncomeCategoryRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { Page> result = new Page<>(); List> records = new ArrayList<>(); @@ -448,7 +432,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary return result; } - private Page> buildSubComRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { + private PageInfo> buildSubComRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { Page> result = new Page<>(); List> records = new ArrayList<>(); @@ -500,7 +484,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary return result; } - private Page> buildDepartRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { + private PageInfo> buildDepartRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { Page> result = new Page<>(); List> records = new ArrayList<>(); @@ -558,7 +542,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary return result; } - private Page> buildPositionRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { + private PageInfo> buildPositionRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { Page> result = new Page<>(); List> records = new ArrayList<>(); @@ -616,7 +600,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary return result; } - private Page> buildGradeRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { + private PageInfo> buildGradeRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { Page> result = new Page<>(); List> records = new ArrayList<>(); @@ -674,7 +658,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary return result; } - private Page> buildStatusRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { + private PageInfo> buildStatusRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { Page> result = new Page<>(); List> records = new ArrayList<>(); @@ -731,7 +715,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary return result; } - private Page> buildTypeRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { + private PageInfo> buildTypeRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { Page> result = new Page<>(); List> records = new ArrayList<>(); @@ -750,7 +734,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary return result; } - private Page> buildEmployeeRecords(SalaryStatisticsReportDataQueryParam param, SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { + private PageInfo> buildEmployeeRecords(SalaryStatisticsReportDataQueryParam param, SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { List employeeIds = data.getList().stream().map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList()); Page> result = new Page<>(param.getCurrent(), param.getPageSize(), employeeIds.size(), true); List> records = new ArrayList<>(); @@ -776,12 +760,12 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary return result; } - private Page> buildQuarterRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { + private PageInfo> buildQuarterRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { Page> result = new Page<>(); List> records = new ArrayList<>(); Set quarterSet = Sets.newHashSet(); - data.getList().forEach(sa ->quarterSet.add(ReportTimeUtil.getQuarter(sa.getSalaryMonth()))); + data.getList().forEach(sa -> quarterSet.add(ReportTimeUtil.getQuarter(sa.getSalaryMonth()))); List quarters = Lists.newArrayList(quarterSet).stream().sorted().collect(Collectors.toList()); Collections.reverse(quarters); @@ -799,12 +783,12 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary return result; } - private Page> buildHalfYearRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { + private PageInfo> buildHalfYearRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { Page> result = new Page<>(); List> records = new ArrayList<>(); Set halfYearSet = Sets.newHashSet(); - data.getList().forEach(sa ->halfYearSet.add(ReportTimeUtil.getHalfYear(sa.getSalaryMonth()))); + data.getList().forEach(sa -> halfYearSet.add(ReportTimeUtil.getHalfYear(sa.getSalaryMonth()))); List halfYears = Lists.newArrayList(halfYearSet).stream().sorted().collect(Collectors.toList()); Collections.reverse(halfYears); @@ -1391,6 +1375,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary result.setRecords(records); return result; } + private Page> buildAgeRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { Page> result = new Page<>(); List> records = new ArrayList<>(); diff --git a/src/com/engine/salary/report/service/impl/SubTableExportServiceImpl.java b/src/com/engine/salary/report/service/impl/SubTableExportServiceImpl.java new file mode 100644 index 000000000..1399f8eaa --- /dev/null +++ b/src/com/engine/salary/report/service/impl/SubTableExportServiceImpl.java @@ -0,0 +1,186 @@ +package com.engine.salary.report.service.impl; + +import com.engine.salary.report.service.SubTableExportService; + +/** + * @Description: + * @Author: zhangheng + * @CreateDate: 2022/11/9 + * @Version: v1.0 + */ +public class SubTableExportServiceImpl implements SubTableExportService { + +// private Logger logger = LoggerFactory.getLogger(this.getClass()); +// +// @Autowired +// private SalaryBatchService salaryBatchService; +// +// @Override +// public Map exportCommon(ExportCommonParam param, User currentUser, String tenantKey) { +// Map map = new HashMap<>(3); +// map.put("biz", String.valueOf(IdGenerator.generate())); +// map.put("module", EntityType.hrsa.name()); +// map.put("function", "welfareCommonExcel"); +// String eteamsId = TenantRpcContext.getEteamsId(); +// LocalRunnable localRunnable = new LocalRunnable() { +// @Override +// public void execute() { +// try { +// DSTenantKeyThreadVar.tenantKey.set(tenantKey); +// exportTask(param, map, eteamsId, currentUser.getUsername(), currentUser.getEmployeeId(), tenantKey); +// } finally { +// DSTenantKeyThreadVar.tenantKey.remove(); +// } +// } +// }; +// ThreadPoolUtil.execute(localRunnable); +// return map; +// } +// +// public Map exportTask(ExportCommonParam param, Map exportMap, String eteamsId, String operateName, Long employeeId, String tenantKey) { +// List sheetList = new LinkedList<>(); +// // 工作簿 +// ExcelSheetData excelSheetData = new ExcelSheetData(); +// // 工作簿名称 +// excelSheetData.setSheetName(param.getSheetName()); +// // 报表头 +// excelSheetData.setHeaders(buildHeader(param.getColumns(), new ArrayList<>(), param.getDimensionName())); +// // 报表数据 +// excelSheetData.setRows(buildCommonData(param)); +// // 报表表头合并 +// excelSheetData.setMergedRegions(buildMergedRegions(param.getColumns())); +// // 塞进工作簿list +// sheetList.add(excelSheetData); +// // 发送 +// Map map = salaryBatchService.simpleExportExcel(ExportExcelInfo.builder() +// .bizId(exportMap.get("biz")) +// .sharePassword(param.getSharePassword()) +// .flag(true) +// .module(exportMap.get("module")) +// .userId(employeeId) +// .eteamsId(eteamsId) +// .tenantKey(tenantKey) +// .operator(operateName) +// .fileName(param.getSheetName() + ReportTimeUtil.getFormatLocalDateTime(LocalDateTime.now())) +// .handlerName("welfareCommonExcelExportHandler") +// .dataType(param.getSheetName()) +// .function("welfareCommonExcel").build(), sheetList); +// return map; +// +// } +// +// @BatchExportHandler("welfareCommonExcelExportHandler") +// public void welfareCommonExcelExportHandler() { +// BatchCallbackMessage message = BatchExportContext.getBatchCallbackMessage(); +// logger.info(SalaryI18nUtil.getI18nLabel(100292, "接受到导出的结果") + JSONObject.toJSONString(message)); +// } +// +// public int getHigh(ExportColumn column) { +// int tempHign = 1; +// if (column.getChildren() != null) { +// tempHign++; +// List children = column.getChildren(); +// for (ExportColumn exportColumn : children) { +// getHigh(exportColumn); +// } +// } +// return tempHign; +// } +// +// public List buildMergedRegions(List columns) { +// List merges = new ArrayList<>(); +// if (CollectionUtils.isEmpty(columns)) { +// return merges; +// } +// int start = 0; +// int high = 0; +// for (int i = 0; i < columns.size(); i++) { +// int columnHigh = getHigh(columns.get(i)); +// high = Math.max(high, columnHigh); +// } +// if (high == 1) { +// return null; +// } +// +// for (int i = 0; i < columns.size(); i++) { +// if (columns.get(i).getChildren() == null) { +// merges.add(new Integer[]{start, 1, 0, 0}); +// start++; +// } else if (columns.get(i).getChildren().size() == 1) { +// start++; +// } else { +// int end = start + columns.get(i).getChildren().size() - 1; +// merges.add(new Integer[]{0, 0, start, end}); +// end++; +// start = end; +// } +// } +// return merges; +// } +// +// public List> buildCommonData(ExportCommonParam param) { +// List keyIndexOrder = new ArrayList<>(); +// buildCommonKeyIndex(param.getColumns(), keyIndexOrder); +// List> result = new ArrayList<>(); +// param.getData().forEach(dataMap -> { +// List temp = new ArrayList<>(); +// keyIndexOrder.forEach(key -> { +// temp.add(dataMap.get(key)); +// }); +// result.add(temp); +// }); +// return result; +// } +// +// public void buildCommonKeyIndex(List list, List keyIndexOrder) { +// List children = new ArrayList<>(); +// if (CollectionUtils.isEmpty(list)) { +// return; +// } +// list.forEach(column -> { +// if (column.getChildren() == null) { +// keyIndexOrder.add(column.getKeyIndex()); +// } else { +// children.addAll(column.getChildren()); +// } +// }); +// buildCommonKeyIndex(children, keyIndexOrder); +// } +// +// public List buildHeader(List list, List result, String dimensionName) { +// List headers = buildCommonHeader(list, result); +// int size = headers.size(); +// List header = new ArrayList<>(Arrays.asList(headers.get(size - 1))); +// header.add(0, dimensionName); +// result.set(size - 1, header.toArray(new String[0])); +// return result; +// } +// +// /** +// * 多层级表头 +// * +// * @param list +// * @param result +// * @return +// */ +// public List buildCommonHeader(List list, List result) { +// List childList = new ArrayList<>(); +// if (CollectionUtils.isEmpty(list)) { +// return result; +// } +// List temp = new ArrayList<>(); +// list.forEach(column -> { +// if (column.getChildren() != null) { +// childList.addAll(column.getChildren()); +// column.getChildren().forEach(x -> temp.add(column.getValue())); +// } else { +// temp.add(column.getValue()); +// } +// }); +// result.add(temp.toArray(new String[0])); +// if (CollectionUtils.isNotEmpty(childList)) { +// buildCommonHeader(childList, result); +// } +// return result; +// } +} diff --git a/src/com/engine/salary/report/web/SalaryStatisticsReportController.java b/src/com/engine/salary/report/web/SalaryStatisticsReportController.java index 3020a525b..0d66ec25a 100644 --- a/src/com/engine/salary/report/web/SalaryStatisticsReportController.java +++ b/src/com/engine/salary/report/web/SalaryStatisticsReportController.java @@ -1,18 +1,21 @@ package com.engine.salary.report.web; +import com.engine.common.util.ServiceUtil; +import com.engine.salary.report.entity.param.SalaryStatisticsReportDataQueryParam; +import com.engine.salary.report.entity.param.SalaryStatisticsReportQueryParam; +import com.engine.salary.report.entity.param.SalaryStatisticsReportSaveParam; +import com.engine.salary.report.entity.po.SalaryStatisticsReportPO; import com.engine.salary.report.wrapper.SalaryStatisticsReportWrapper; -import com.weaver.common.authority.annotation.WeaPermission; -import com.weaver.common.base.entity.result.WeaResult; -import com.weaver.common.component.form.WeaForm; -import com.weaver.common.component.search.WeaSearchCondition; -import com.weaver.salary.report.entity.param.*; -import com.weaver.teams.security.context.TenantContext; -import com.weaver.teams.security.context.UserContext; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.RequestParam; +import com.engine.salary.util.ResponseResult; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +import weaver.hrm.HrmUserVarify; +import weaver.hrm.User; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.*; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; import java.util.Collection; import java.util.List; import java.util.Map; @@ -22,24 +25,24 @@ import java.util.Map; * @Author: wangxiangzhong * @Date: 2022/12/15 11:40 */ -@Api("薪酬统计报表") -@RestController -@RequestMapping("/api/bs/salaryreport/salary/statistics/report") public class SalaryStatisticsReportController { - @Autowired - private SalaryStatisticsReportWrapper salaryStatisticsReportWrapper; + private SalaryStatisticsReportWrapper getSalaryStatisticsReportWrapper(User user) { + return ServiceUtil.getService(SalaryStatisticsReportWrapper.class, user); + } + /** * 薪酬统计报表列表 * * @return */ - @PostMapping("/list") - @ApiOperation("薪酬统计报表列表") - @WeaPermission(publicPermission = true) - public WeaResult>> list(@RequestBody SalaryStatisticsReportQueryParam queryParam) { - return WeaResult.success(salaryStatisticsReportWrapper.list(queryParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey())); + @POST + @Path("/list") + @Produces(MediaType.APPLICATION_JSON) + public String list(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryStatisticsReportQueryParam queryParam) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>>(user).run(getSalaryStatisticsReportWrapper(user)::list, queryParam); } /** @@ -47,24 +50,26 @@ public class SalaryStatisticsReportController { * * @return */ - @GetMapping("/getForm") - @ApiOperation("获取薪酬统计报表表单") - @WeaPermission(publicPermission = true) - public WeaResult getFrom(@RequestParam(value = "id", required = false) Long id) { - return WeaResult.success(salaryStatisticsReportWrapper.getFrom(id, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey())); + @GET + @Path("/getForm") + @Produces(MediaType.APPLICATION_JSON) + public String getForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "id") Long id) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult(user).run(getSalaryStatisticsReportWrapper(user)::getFrom, id); } /** * 保存薪酬统计报表 * - * @param saveParam + * @param param * @return */ - @PostMapping("/save") - @ApiOperation("保存薪酬统计报表") - @WeaPermission(publicPermission = true) - public WeaResult save(@RequestBody SalaryStatisticsReportSaveParam saveParam) { - return WeaResult.success(salaryStatisticsReportWrapper.save(saveParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey())); + @POST + @Path("/save") + @Produces(MediaType.APPLICATION_JSON) + public String save(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryStatisticsReportSaveParam param) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult(user).run(getSalaryStatisticsReportWrapper(user)::save, param); } /** @@ -73,38 +78,34 @@ public class SalaryStatisticsReportController { * @param ids * @return */ - @PostMapping("/delete") - @ApiOperation("删除薪酬统计报表") - @WeaPermission(publicPermission = true) - public WeaResult> delete(@RequestBody Collection ids) { - return WeaResult.success(salaryStatisticsReportWrapper.delete(ids, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey())); + @POST + @Path("/delete") + @Produces(MediaType.APPLICATION_JSON) + public String delete(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Collection ids) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult, Map>(user).run(getSalaryStatisticsReportWrapper(user)::delete, ids); } - /** - * 获取薪酬统计报表查询条件 - * - * @param id - * @return - */ - @GetMapping("/getSearchCondition") - @ApiOperation("获取薪酬统计报表查询条件") - @WeaPermission(publicPermission = true) - public WeaResult getSearchCondition(@RequestParam Long id) { - return WeaResult.success(salaryStatisticsReportWrapper.getSearchCondition(id, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey())); - } - /** - * 保存薪酬统计报表查询条件 - * - * @param param - * @return - */ - @PostMapping("/saveSearchCondition") - @ApiOperation("保存薪酬统计报表查询条件") - @WeaPermission(publicPermission = true) - public WeaResult saveSearchCondition(@RequestBody SalaryStatisticsSearchConditionSaveParam param) { - return WeaResult.success(salaryStatisticsReportWrapper.saveSearchCondition(param, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey())); - } +// @GetMapping("/getSearchCondition") +// @ApiOperation("获取薪酬统计报表查询条件") +// @WeaPermission(publicPermission = true) +// public WeaResult getSearchCondition(@RequestParam Long id) { +// return WeaResult.success(salaryStatisticsReportWrapper.getSearchCondition(id, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey())); +// } + +// /** +// * 保存薪酬统计报表查询条件 +// * +// * @param param +// * @return +// */ +// @PostMapping("/saveSearchCondition") +// @ApiOperation("保存薪酬统计报表查询条件") +// @WeaPermission(publicPermission = true) +// public WeaResult saveSearchCondition(@RequestBody SalaryStatisticsSearchConditionSaveParam param) { +// return WeaResult.success(salaryStatisticsReportWrapper.saveSearchCondition(param, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey())); +// } /** * 获取薪酬统计报表数据 @@ -112,23 +113,23 @@ public class SalaryStatisticsReportController { * @param param * @return */ - @PostMapping("/getData") - @ApiOperation("获取薪酬统计报表数据") - @WeaPermission(publicPermission = true) - public WeaResult> getData(@RequestBody SalaryStatisticsReportDataQueryParam param) { - return WeaResult.success(salaryStatisticsReportWrapper.getData(param, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey())); + @POST + @Path("/getData") + @Produces(MediaType.APPLICATION_JSON) + public String delete(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryStatisticsReportDataQueryParam param) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>(user).run(getSalaryStatisticsReportWrapper(user)::getData, param); } - /** - * 导出报表数据 - * - * @param param - * @return - */ - @PostMapping("/exportData") - @ApiOperation("导出报表数据") - @WeaPermission(publicPermission = true) - public WeaResult> exportData(@RequestBody SalaryStatisticsReportDataQueryParam param) { - return WeaResult.success(salaryStatisticsReportWrapper.exportData(param, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey())); - } +// /** +// * 导出报表数据 +// * +// * @param param +// * @return +// */ +// @PostMapping("/exportData") +// @ApiOperation("导出报表数据") +// @WeaPermission(publicPermission = true) +// public WeaResult> exportData(@RequestBody SalaryStatisticsReportDataQueryParam param) { +// return WeaResult.success(salaryStatisticsReportWrapper.exportData(param, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey())); } diff --git a/src/com/engine/salary/report/wrapper/SalaryStatisticsReportWrapper.java b/src/com/engine/salary/report/wrapper/SalaryStatisticsReportWrapper.java index c7a1bc5fa..f26271fdb 100644 --- a/src/com/engine/salary/report/wrapper/SalaryStatisticsReportWrapper.java +++ b/src/com/engine/salary/report/wrapper/SalaryStatisticsReportWrapper.java @@ -1,44 +1,28 @@ package com.engine.salary.report.wrapper; -import com.alibaba.fastjson.JSONArray; +import com.cloudstore.eccom.pc.table.WeaTableColumn; +import com.engine.core.impl.Service; +import com.engine.salary.exception.SalaryRunTimeException; +import com.engine.salary.report.entity.bo.SalaryStatisticsReportBO; +import com.engine.salary.report.entity.param.SalaryStatisticsReportDataQueryParam; +import com.engine.salary.report.entity.param.SalaryStatisticsReportQueryParam; +import com.engine.salary.report.entity.param.SalaryStatisticsReportSaveParam; +import com.engine.salary.report.entity.param.SalaryStatisticsSearchConditionSaveParam; +import com.engine.salary.report.entity.po.SalaryStatisticsDimensionPO; +import com.engine.salary.report.entity.po.SalaryStatisticsItemPO; +import com.engine.salary.report.entity.po.SalaryStatisticsReportPO; +import com.engine.salary.report.service.SalaryStatisticsDimensionService; +import com.engine.salary.report.service.SalaryStatisticsItemService; import com.engine.salary.report.service.SalaryStatisticsReportService; -import com.google.common.base.Joiner; +import com.engine.salary.report.service.SubTableExportService; +import com.engine.salary.util.JsonUtil; +import com.engine.salary.util.SalaryEntityUtil; +import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.page.PageInfo; import com.google.common.collect.Maps; -import com.weaver.common.authority.format.FormatManager; -import com.weaver.common.component.browser.entity.WeaBrowserBean; -import com.weaver.common.component.form.WeaForm; -import com.weaver.common.component.form.item.WeaFormItem; -import com.weaver.common.component.form.item.WeaFormOption; -import com.weaver.common.component.search.WeaSearchCondition; -import com.weaver.common.component.search.item.WeaSearchConditionItem; -import com.weaver.common.component.search.item.WeaSearchConditionItemType; -import com.weaver.common.component.search.layout.WeaSearchConditionLayout; -import com.weaver.common.component.table.WeaTable; -import com.weaver.common.component.table.column.WeaTableColumn; -import com.weaver.common.component.table.page.Page; -import com.weaver.framework.util.JsonUtil; -import com.weaver.salary.report.common.constant.SalaryReportModule; -import com.weaver.salary.report.entity.bo.SalaryStatisticsReportBO; -import com.weaver.salary.report.entity.dto.SalaryStatisticsReportFormDTO; -import com.weaver.salary.report.entity.param.*; -import com.weaver.salary.report.entity.po.SalaryStatisticsDimensionPO; -import com.weaver.salary.report.entity.po.SalaryStatisticsItemPO; -import com.weaver.salary.report.entity.po.SalaryStatisticsReportPO; -import com.weaver.salary.report.enums.WeaBrowserTypeEnum; -import com.weaver.salary.report.exception.SalaryRunTimeException; -import com.weaver.salary.report.service.SalaryStatisticsDimensionService; -import com.weaver.salary.report.service.SalaryStatisticsItemService; -import com.weaver.salary.report.service.SubTableExportService; -import com.weaver.salary.report.util.*; -import com.weaver.teams.security.context.TenantContext; -import com.weaver.teams.security.context.UserContext; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import javax.annotation.Resource; import java.util.*; import java.util.stream.Collectors; @@ -48,37 +32,34 @@ import java.util.stream.Collectors; * @Date: 2022/12/15 13:46 */ @Component -public class SalaryStatisticsReportWrapper { +public class SalaryStatisticsReportWrapper extends Service { private static final String conditionId = "salaryStatisticsReportSearchCondition"; - + private SalaryStatisticsReportService salaryStatisticsReportService; - + private SalaryStatisticsItemService salaryStatisticsItemService; - + private SalaryStatisticsDimensionService salaryStatisticsDimensionService; - @Autowired + private SubTableExportService subTableExportService; /** * 报表列表 * - * * @param queryParam - * @param currentEmployeeId - * @param currentTenantKey * @return */ - public List> list(SalaryStatisticsReportQueryParam queryParam, Long currentEmployeeId, String currentTenantKey) { + public List> list(SalaryStatisticsReportQueryParam queryParam) { // 初始化 - salaryStatisticsDimensionService.init(currentEmployeeId, currentTenantKey); + salaryStatisticsDimensionService.init((long)user.getUID()); - List reportList = salaryStatisticsReportService.list(currentEmployeeId, currentTenantKey); + List reportList = salaryStatisticsReportService.list(); if (StringUtils.isNotEmpty(queryParam.getReportName())) { reportList = reportList.stream().filter(rp -> rp.getReportName().contains(queryParam.getReportName())).collect(Collectors.toList()); } - List salaryStatisticsDimensionList = this.salaryStatisticsDimensionService.listAll(currentTenantKey); + List salaryStatisticsDimensionList = this.salaryStatisticsDimensionService.listAll(); Map salaryStatisticsDimensionMap = SalaryEntityUtil.convert2Map(salaryStatisticsDimensionList, k -> k.getId().toString(), SalaryStatisticsDimensionPO::getDimName); List> result = new ArrayList<>(); reportList.forEach(po -> { @@ -86,8 +67,8 @@ public class SalaryStatisticsReportWrapper { temp.put("id", po.getId().toString()); temp.put("reportName", po.getReportName()); - List dimNames = Arrays.stream(po.getDimension().split(",")).map(dim -> Optional.ofNullable(salaryStatisticsDimensionMap.get(dim)).orElse("")).collect(Collectors.toList()); - temp.put("dimension", Joiner.on(",").join(dimNames)); + List dimNames = Arrays.stream(po.getDimension().split(",")).map(dim -> Optional.ofNullable(salaryStatisticsDimensionMap.get(dim)).orElse("")).collect(Collectors.toList()); + temp.put("dimension", StringUtils.join(dimNames, ",")); temp.put("dimensionId", po.getDimension()); result.add(temp); }); @@ -98,246 +79,86 @@ public class SalaryStatisticsReportWrapper { * 获取薪酬统计报表表单 * * @param id - * @param currentEmployeeId - * @param currentTenantKey + * @param * @return */ - public WeaForm getFrom(Long id, Long currentEmployeeId, String currentTenantKey) { + public SalaryStatisticsReportPO getFrom(Long id) { - List salaryStatisticsDimensions = salaryStatisticsDimensionService.listAll(currentTenantKey); - List statsDimOptions = salaryStatisticsDimensions.stream().map(sd -> new WeaFormOption(sd.getId().toString(), sd.getDimName())).collect(Collectors.toList()); - // 1.构建基础信息表单 - WeaForm weaForm = FormatManager.getInstance().genForm(SalaryStatisticsReportFormDTO.class, SalaryStatisticsReportFormDTO.builder().statsDimOptions(statsDimOptions).build()); + List salaryStatisticsDimensions = salaryStatisticsDimensionService.listAll(); - String placeholder = SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 85987, "请输入"); + String placeholder = SalaryI18nUtil.getI18nLabel(85987, "请输入"); - WeaFormItem nameItem = weaForm.getItems().get("reportName"); - Map otherParams = Maps.newHashMap(); - otherParams.put("showCount", true); - otherParams.put("placeholder", placeholder); - nameItem.setOtherParams(otherParams); - weaForm.getItems().put("reportName", nameItem); - - if (id != null) { - SalaryStatisticsReportPO po = this.salaryStatisticsReportService.getById(id, currentTenantKey); - if (po == null) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 161845, "薪酬统计报表不存在")); - } - Map dataMap = JsonUtil.parseMap(po, Object.class); - dataMap.put("dimension", Arrays.asList(po.getDimension().split(","))); - weaForm.setData(dataMap); + SalaryStatisticsReportPO po = this.salaryStatisticsReportService.getById(id); + if (po == null) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(161845, "薪酬统计报表不存在")); } - return weaForm; + return po; } /** * 保存薪酬统计报表 * * @param saveParam - * @param currentEmployeeId - * @param currentTenantKey + * @param * @return */ - public String save(SalaryStatisticsReportSaveParam saveParam, Long currentEmployeeId, String currentTenantKey) { - return salaryStatisticsReportService.save(saveParam, currentEmployeeId, currentTenantKey); + public String save(SalaryStatisticsReportSaveParam saveParam) { + return salaryStatisticsReportService.save(saveParam); } /** * 删除薪酬统计报表 * * @param ids - * @param currentEmployeeId - * @param currentTenantKey + * @param * @return */ - public Map delete(Collection ids, Long currentEmployeeId, String currentTenantKey) { - return salaryStatisticsReportService.delete(ids, currentEmployeeId, currentTenantKey); + public Map delete(Collection ids) { + return salaryStatisticsReportService.delete(ids); } + - /** - * 获取统计条件 - * - * @param id - * @param employeeId - * @param tenantKey - * @return - */ - public WeaSearchCondition getSearchCondition(Long id, Long employeeId, String tenantKey) { - // 高级搜索实例 - WeaSearchCondition weaSearchCondition = new WeaSearchCondition(conditionId); - - if (id != null) { - SalaryStatisticsReportPO po = this.salaryStatisticsReportService.getById(id, tenantKey); - SalaryAssert.notNull(po, SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 152563, "报表不存在")); - - Map data = new HashMap<>(); - data.put("salaryStartMonth", ReportTimeUtil.getFormatYearMonth(po.getSalaryStartMonth())); - data.put("salaryEndMonth", ReportTimeUtil.getFormatYearMonth(po.getSalaryEndMonth())); - data.put("taxAgent", JSONArray.parseArray(po.getTaxAgentSetting())); - data.put("incomeCategory", JSONArray.parseArray(po.getIncomeCategorySetting())); - data.put("subCompany", JSONArray.parseArray(po.getSubCompanySetting())); - data.put("department", JSONArray.parseArray(po.getDepartSetting())); - data.put("grade", JSONArray.parseArray(po.getGradeSetting())); - data.put("position", JSONArray.parseArray(po.getPositionSetting())); - data.put("status", JSONArray.parseArray(po.getStatusSetting())); - data.put("employee", JSONArray.parseArray(po.getEmployeeSetting())); - data.put("hiredate", JSONArray.parseArray(po.getHiredateSetting())); -// data.put("leavedate", JSONArray.parseArray(po.getLeavedateSetting())); - - weaSearchCondition.setData(data); - } - - // 搜索项目 - // 个税扣缴义务人 - WeaSearchConditionItem taxAgent = new WeaSearchConditionItem(); - taxAgent.setItemType(WeaSearchConditionItemType.BROWSER); - WeaBrowserBean paymentOrgBrowserBean = new WeaBrowserBean(SalaryReportModule.BROWSER_MODULE, WeaBrowserTypeEnum.TAX_AGENT.getBrowserType(), Boolean.TRUE); - taxAgent.setBrowserBean(paymentOrgBrowserBean); - weaSearchCondition.getItems().put("taxAgent", taxAgent); - // 收入所得项目 - WeaSearchConditionItem incomeCategory = new WeaSearchConditionItem(); - incomeCategory.setItemType(WeaSearchConditionItemType.BROWSER); - WeaBrowserBean incomeCategoryBrowserBean = new WeaBrowserBean(SalaryReportModule.BROWSER_MODULE, WeaBrowserTypeEnum.INCOME_CATEGORY.getBrowserType(), Boolean.TRUE); - incomeCategory.setBrowserBean(incomeCategoryBrowserBean); - weaSearchCondition.getItems().put("incomeCategory", incomeCategory); - // 分部 - WeaSearchConditionItem subCompany = new WeaSearchConditionItem(); - subCompany.setItemType(WeaSearchConditionItemType.BROWSER); - WeaBrowserBean subcompanyBrowserBean = new WeaBrowserBean(SalaryReportModule.BROWSER_MODULE, "subcompany", Boolean.TRUE); - subCompany.setBrowserBean(subcompanyBrowserBean); - weaSearchCondition.getItems().put("subCompany", subCompany); - // 部门 - WeaSearchConditionItem department = new WeaSearchConditionItem(); - department.setItemType(WeaSearchConditionItemType.BROWSER); - WeaBrowserBean departmentBrowserBean = new WeaBrowserBean(SalaryReportModule.BROWSER_MODULE, "department", Boolean.TRUE); - department.setBrowserBean(departmentBrowserBean); - weaSearchCondition.getItems().put("department", department); - // 职级 - WeaSearchConditionItem grade = new WeaSearchConditionItem(); - grade.setItemType(WeaSearchConditionItemType.BROWSER); - WeaBrowserBean gradeBrowserBean = new WeaBrowserBean(SalaryReportModule.BROWSER_MODULE, "grade", Boolean.TRUE); - grade.setBrowserBean(gradeBrowserBean); - weaSearchCondition.getItems().put("grade", grade); - // 岗位 - WeaSearchConditionItem position = new WeaSearchConditionItem(); - position.setItemType(WeaSearchConditionItemType.BROWSER); - WeaBrowserBean positionBrowserBean = new WeaBrowserBean(SalaryReportModule.BROWSER_MODULE, "position", Boolean.TRUE); - position.setBrowserBean(positionBrowserBean); - weaSearchCondition.getItems().put("position", position); - // 人事状态 - WeaSearchConditionItem status = new WeaSearchConditionItem(); - status.setItemType(WeaSearchConditionItemType.BROWSER); - WeaBrowserBean statusBrowserBean = new WeaBrowserBean(SalaryReportModule.BROWSER_MODULE, WeaBrowserTypeEnum.USER_STATUS.getBrowserType(), Boolean.TRUE); - status.setBrowserBean(statusBrowserBean); - weaSearchCondition.getItems().put("status", status); - // 人员 - WeaSearchConditionItem employee = new WeaSearchConditionItem(); - employee.setItemType(WeaSearchConditionItemType.BROWSER); - WeaBrowserBean employeeBrowserBean = new WeaBrowserBean(SalaryReportModule.BROWSER_MODULE, "resource", Boolean.TRUE); - employee.setBrowserBean(employeeBrowserBean); - weaSearchCondition.getItems().put("employee", employee); - - Map otherParams = Maps.newHashMap(); - otherParams.put("isRange", true); - otherParams.put("type", "day"); - otherParams.put("startPlaceholder", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 90648, "开始日期")); - otherParams.put("endPlaceholder", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 90649, "结束日期")); -// 在otherParams中添加 showMultiBtnGroup showUnlimit 这两个字段 并且都为false - // 入职日期 - WeaSearchConditionItem hiredate = new WeaSearchConditionItem(); - hiredate.setItemType(WeaSearchConditionItemType.DATEPICKER); - hiredate.setOtherParams(otherParams); - weaSearchCondition.getItems().put("hiredate", hiredate); - // 离职日期 - WeaSearchConditionItem leavedate = new WeaSearchConditionItem(); - leavedate.setItemType(WeaSearchConditionItemType.INPUT); - leavedate.setReadOnly(true); -// leavedate.setItemType(WeaSearchConditionItemType.DATEPICKER); -// leavedate.setOtherParams(otherParams); - weaSearchCondition.getItems().put("leavedate", leavedate); - - //layout布局 - List firstLine = new ArrayList<>(); - firstLine.add(new WeaSearchConditionLayout("taxAgent", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86184, "个税扣缴义务人"), new String[]{"taxAgent"})); - firstLine.add(new WeaSearchConditionLayout("incomeCategory", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 121908, "收入所得项目"), new String[]{"incomeCategory"})); - List secondLine = new ArrayList<>(); - secondLine.add(new WeaSearchConditionLayout("subCompany", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 107369, "分部"), new String[]{"subCompany"})); - secondLine.add(new WeaSearchConditionLayout("department", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86185, "部门"), new String[]{"department"})); - List thirdLine = new ArrayList<>(); - thirdLine.add(new WeaSearchConditionLayout("grade", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 98623, "职级"), new String[]{"grade"})); - thirdLine.add(new WeaSearchConditionLayout("position", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 90633, "岗位"), new String[]{"position"})); - List forthLine = new ArrayList<>(); - forthLine.add(new WeaSearchConditionLayout("status", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 109332, "人事状态"), new String[]{"status"})); - forthLine.add(new WeaSearchConditionLayout("employee", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100133, "人员"), new String[]{"employee"})); - List fifthLine = new ArrayList<>(); - fifthLine.add(new WeaSearchConditionLayout("hiredate", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86319, "入职日期"), new String[]{"hiredate"})); -// fifthLine.add(new WeaSearchConditionLayout("leavedate", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 95228, "离职日期"), new String[]{"leavedate"})); - fifthLine.add(new WeaSearchConditionLayout("leavedate", " ", new String[]{"leavedate"})); - - weaSearchCondition.getLayout().add(firstLine); - weaSearchCondition.getLayout().add(secondLine); - weaSearchCondition.getLayout().add(thirdLine); - weaSearchCondition.getLayout().add(forthLine); - weaSearchCondition.getLayout().add(fifthLine); - return weaSearchCondition; - } - - public String saveSearchCondition(SalaryStatisticsSearchConditionSaveParam param, Long currentEmployeeId, String currentTenantKey) { - return this.salaryStatisticsReportService.saveSearchCondition(param, currentEmployeeId, currentTenantKey); + public String saveSearchCondition(SalaryStatisticsSearchConditionSaveParam param) { + return this.salaryStatisticsReportService.saveSearchCondition(param); } /** * 获取报表数据 * * @param param - * @param employeeId - * @param tenantKey * @return */ - public Map getData(SalaryStatisticsReportDataQueryParam param, Long employeeId, String tenantKey) { + public Map getData(SalaryStatisticsReportDataQueryParam param) { if (param.getId() == null || param.getDimensionId() == null) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误")); } - SalaryStatisticsDimensionPO dimension = salaryStatisticsDimensionService.getById(param.getDimensionId(), tenantKey); + SalaryStatisticsDimensionPO dimension = salaryStatisticsDimensionService.getById(param.getDimensionId()); if (dimension == null) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 161300, "统计维度不存在")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(161300, "统计维度不存在")); } // weaTable对象 - WeaTable> weaTable = new WeaTable<>(); + Map weaTable= new HashMap<>(); // 查询报表配置 - SalaryStatisticsReportPO po = this.salaryStatisticsReportService.getById(param.getId(), tenantKey); + SalaryStatisticsReportPO po = this.salaryStatisticsReportService.getById(param.getId()); if (po == null) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 161845, "薪酬统计报表不存在")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(161845, "薪酬统计报表不存在")); } // 查询自定义统计项目 - List salaryStatisticsItemList = this.salaryStatisticsItemService.listByStatisticsReportId(po.getId(), employeeId, tenantKey); + List salaryStatisticsItemList = this.salaryStatisticsItemService.listByStatisticsReportId(po.getId()); // 列表data - Page> page = this.salaryStatisticsReportService.buildReportRecords(dimension, param, po, salaryStatisticsItemList, employeeId, tenantKey); + PageInfo> page = this.salaryStatisticsReportService.buildReportRecords(dimension, param, po, salaryStatisticsItemList); // 组装合计 - Map countResultMap = SalaryStatisticsReportBO.buildTotal(page, salaryStatisticsItemList, employeeId, tenantKey); + Map countResultMap = SalaryStatisticsReportBO.buildTotal(page, salaryStatisticsItemList,(long)user.getUID()); - // 人员维度分页 - if (Objects.equal(dimension.getDimCode(), "employee")) { - if (CollectionUtils.isNotEmpty(page.getRecords())) { - page.setRecords(SalaryPageUtil.subList((int) page.getCurrent(), (int) page.getSize(), page.getRecords())); - weaTable.setCurrent(page.getCurrent()); - weaTable.setTotal(page.getTotal()); - weaTable.setPageSize(page.getSize()); - } - } - - weaTable.setData(page.getRecords()); - weaTable.setModule(SalaryReportModule.BROWSER_MODULE); // 列表columns - List weaTableColumns = SalaryStatisticsReportBO.buildReportColumns(dimension.getDimName(), salaryStatisticsItemList, employeeId, tenantKey); - weaTable.setColumns(weaTableColumns); - // pageuid - weaTable.setPageUid("salaryStatisticsReportDataPage"); + List weaTableColumns = SalaryStatisticsReportBO.buildReportColumns(dimension.getDimName(), salaryStatisticsItemList); Map resultMap = Maps.newHashMap(); resultMap.putAll(JsonUtil.parseMap(weaTable, Object.class)); + resultMap.put("columns", weaTableColumns); + resultMap.put("pageInfo", page); resultMap.put("countResult", countResultMap); return resultMap; } @@ -351,36 +172,37 @@ public class SalaryStatisticsReportWrapper { * @return */ public Map exportData(SalaryStatisticsReportDataQueryParam param, Long employeeId, String tenantKey) { - if (param.getId() == null || param.getDimensionId() == null) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误")); - } - - SalaryStatisticsReportPO po = this.salaryStatisticsReportService.getById(param.getId(), tenantKey); - if (po == null) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 161845, "薪酬统计报表不存在")); - } - SalaryStatisticsDimensionPO dimension = salaryStatisticsDimensionService.getById(param.getDimensionId(), tenantKey); - if (dimension == null) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 161300, "统计维度不存在")); - } - // 查询自定义统计项目 - List salaryStatisticsItemList = this.salaryStatisticsItemService.listByStatisticsReportId(po.getId(), employeeId, tenantKey); - // 列表data - Page> page = this.salaryStatisticsReportService.buildReportRecords(dimension, param, po, salaryStatisticsItemList, employeeId, tenantKey); - // 组装合计 - Map countResultMap = SalaryStatisticsReportBO.buildTotal(page, salaryStatisticsItemList, employeeId, tenantKey); - if (CollectionUtils.isNotEmpty(page.getRecords()) && MapUtils.isNotEmpty(countResultMap)) { - page.getRecords().add(countResultMap); - } - // 获取数据 - List> records = CollectionUtils.emptyIfNull(page.getRecords()).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, employeeId, tenantKey); - - // 组装导出参数 - ExportCommonParam exportParam = SalaryStatisticsReportBO.buildExportParam(dimension.getDimName(), weaTableColumns, records); - exportParam.setSheetName(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 179263, "薪酬统计报表") + "-" + exportParam.getDimensionName()); - return subTableExportService.exportCommon(exportParam, UserContext.getCurrentUser(), TenantContext.getCurrentTenantKey()); +// if (param.getId() == null || param.getDimensionId() == null) { +// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误")); +// } +// +// SalaryStatisticsReportPO po = this.salaryStatisticsReportService.getById(param.getId()); +// if (po == null) { +// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(161845, "薪酬统计报表不存在")); +// } +// SalaryStatisticsDimensionPO dimension = salaryStatisticsDimensionService.getById(param.getDimensionId()); +// if (dimension == null) { +// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(161300, "统计维度不存在")); +// } +// // 查询自定义统计项目 +// List salaryStatisticsItemList = this.salaryStatisticsItemService.listByStatisticsReportId(po.getId()); +// // 列表data +// Page> page = this.salaryStatisticsReportService.buildReportRecords(dimension, param, po, salaryStatisticsItemList); +// // 组装合计 +// Map countResultMap = SalaryStatisticsReportBO.buildTotal(page, salaryStatisticsItemList); +// if (CollectionUtils.isNotEmpty(page.getRecords()) && MapUtils.isNotEmpty(countResultMap)) { +// page.getRecords().add(countResultMap); +// } +// // 获取数据 +// List> records = CollectionUtils.emptyIfNull(page.getRecords()).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); +// +// // 组装导出参数 +// ExportCommonParam exportParam = SalaryStatisticsReportBO.buildExportParam(dimension.getDimName(), weaTableColumns, records); +// exportParam.setSheetName(SalaryI18nUtil.getI18nLabel(179263, "薪酬统计报表") + "-" + exportParam.getDimensionName()); +// return subTableExportService.exportCommon(exportParam, UserContext.getCurrentUser(), TenantContext.get()); + return null; } }