diff --git a/resource/sqlupgrade/DM/sql202307100103.sql b/resource/sqlupgrade/DM/sql202307100103.sql deleted file mode 100644 index e69de29bb..000000000 diff --git a/resource/sqlupgrade/DM/sql202309040303.sql b/resource/sqlupgrade/DM/sql202309040303.sql new file mode 100644 index 000000000..5805822bc --- /dev/null +++ b/resource/sqlupgrade/DM/sql202309040303.sql @@ -0,0 +1,40 @@ +create table hrsa_add_up_deduction_request +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + request_id number not null, + request_status number default 1 not null, + tax_year_month date not null, + outer_request_id varchar2(50) not null, + tax_agent_id number not null +); +/ + +alter table hrsa_add_up_deduction_request add lock_version int; +/ + +alter table hrsa_add_up_deduction_request modify lock_version default 0; +/ + +create table hrsa_add_up_deduction_req_fail +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + request_id number not null, + employee_id number not null, + employee_type int not null, + tax_agent_id number not null, + reason varchar2(255) not null, + tax_year_month date not null, + outer_request_id varchar2(50) not null +); +/ + diff --git a/resource/sqlupgrade/DM/sql202309050103.sql b/resource/sqlupgrade/DM/sql202309050103.sql new file mode 100644 index 000000000..e9e5dfeee --- /dev/null +++ b/resource/sqlupgrade/DM/sql202309050103.sql @@ -0,0 +1,3 @@ +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 (706066600446312885, 1, 674916065864646661, 1, 0, 0, to_date('2022-05-05 16:30:11','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-05 16:30:11','yyyy-MM-dd HH24:mi:ss'), 0, 'all_teams', 703433961629614119, 5); +/ + diff --git a/resource/sqlupgrade/DM/sql202309050203.sql b/resource/sqlupgrade/DM/sql202309050203.sql new file mode 100644 index 000000000..4603c0e75 --- /dev/null +++ b/resource/sqlupgrade/DM/sql202309050203.sql @@ -0,0 +1,30 @@ +alter table hrsa_add_up_situation add add_up_taxable_income varchar2(255); +/ + +alter table hrsa_add_up_situation add actual_add_up_advance_tax varchar2(255); +/ + +alter table hrsa_add_up_situation add tax_adjustment varchar2(255); +/ + +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 (706066600446312885, 1, 674916065864646661, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 5); +/ + +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 (706066600446312886, 1, 674916065864646658, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 6); +/ + +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 (1693896072589, '当前累计减免税额合计', '备注', 'salary', 'salaryitem', 'formula', 'number', 'number', '{"isCustomFunction":"0","sqlReturnKey":"","openDecrypt":"0","datasource":{"datasourceId":""}}', '{薪资项目.本月(次)减免税额}+{往期累计情况.累计减免税额}', 'salaryItem_taxDeduction+addUpSituation_addUpTaxSavings', 27, 0, to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss')); +/ + +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 (1693896072606, '本月(次)减免税额', 1693896072589, 'salaryItem_taxDeduction', '{薪资项目.本月(次)减免税额}', 'number', 'salaryItem', 0, 27, 0, to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss')); +/ + +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 (1693896072611, '累计减免税额', 1693896072589, 'addUpSituation_addUpTaxSavings', '{往期累计情况.累计减免税额}', 'number', 'addUpSituation', 1, 27, 0, to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss')); +/ + +update hrsa_sys_salary_item set value_type = 2 ,formula_id =1693896072589 where id = 674916065864646658; +/ + +update hrsa_salary_item set value_type =2 ,formula_id =1693896072589 where sys_salary_item_id = 674916065864646658; +/ + diff --git a/resource/sqlupgrade/GS/sql202309040303.sql b/resource/sqlupgrade/GS/sql202309040303.sql new file mode 100644 index 000000000..5805822bc --- /dev/null +++ b/resource/sqlupgrade/GS/sql202309040303.sql @@ -0,0 +1,40 @@ +create table hrsa_add_up_deduction_request +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + request_id number not null, + request_status number default 1 not null, + tax_year_month date not null, + outer_request_id varchar2(50) not null, + tax_agent_id number not null +); +/ + +alter table hrsa_add_up_deduction_request add lock_version int; +/ + +alter table hrsa_add_up_deduction_request modify lock_version default 0; +/ + +create table hrsa_add_up_deduction_req_fail +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + request_id number not null, + employee_id number not null, + employee_type int not null, + tax_agent_id number not null, + reason varchar2(255) not null, + tax_year_month date not null, + outer_request_id varchar2(50) not null +); +/ + diff --git a/resource/sqlupgrade/GS/sql202309050103.sql b/resource/sqlupgrade/GS/sql202309050103.sql new file mode 100644 index 000000000..e9e5dfeee --- /dev/null +++ b/resource/sqlupgrade/GS/sql202309050103.sql @@ -0,0 +1,3 @@ +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 (706066600446312885, 1, 674916065864646661, 1, 0, 0, to_date('2022-05-05 16:30:11','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-05 16:30:11','yyyy-MM-dd HH24:mi:ss'), 0, 'all_teams', 703433961629614119, 5); +/ + diff --git a/resource/sqlupgrade/GS/sql202309050203.sql b/resource/sqlupgrade/GS/sql202309050203.sql new file mode 100644 index 000000000..4603c0e75 --- /dev/null +++ b/resource/sqlupgrade/GS/sql202309050203.sql @@ -0,0 +1,30 @@ +alter table hrsa_add_up_situation add add_up_taxable_income varchar2(255); +/ + +alter table hrsa_add_up_situation add actual_add_up_advance_tax varchar2(255); +/ + +alter table hrsa_add_up_situation add tax_adjustment varchar2(255); +/ + +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 (706066600446312885, 1, 674916065864646661, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 5); +/ + +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 (706066600446312886, 1, 674916065864646658, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 6); +/ + +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 (1693896072589, '当前累计减免税额合计', '备注', 'salary', 'salaryitem', 'formula', 'number', 'number', '{"isCustomFunction":"0","sqlReturnKey":"","openDecrypt":"0","datasource":{"datasourceId":""}}', '{薪资项目.本月(次)减免税额}+{往期累计情况.累计减免税额}', 'salaryItem_taxDeduction+addUpSituation_addUpTaxSavings', 27, 0, to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss')); +/ + +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 (1693896072606, '本月(次)减免税额', 1693896072589, 'salaryItem_taxDeduction', '{薪资项目.本月(次)减免税额}', 'number', 'salaryItem', 0, 27, 0, to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss')); +/ + +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 (1693896072611, '累计减免税额', 1693896072589, 'addUpSituation_addUpTaxSavings', '{往期累计情况.累计减免税额}', 'number', 'addUpSituation', 1, 27, 0, to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss')); +/ + +update hrsa_sys_salary_item set value_type = 2 ,formula_id =1693896072589 where id = 674916065864646658; +/ + +update hrsa_salary_item set value_type =2 ,formula_id =1693896072589 where sys_salary_item_id = 674916065864646658; +/ + diff --git a/resource/sqlupgrade/JC/sql202307100103.sql b/resource/sqlupgrade/JC/sql202307100103.sql deleted file mode 100644 index e69de29bb..000000000 diff --git a/resource/sqlupgrade/JC/sql202309040303.sql b/resource/sqlupgrade/JC/sql202309040303.sql new file mode 100644 index 000000000..5805822bc --- /dev/null +++ b/resource/sqlupgrade/JC/sql202309040303.sql @@ -0,0 +1,40 @@ +create table hrsa_add_up_deduction_request +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + request_id number not null, + request_status number default 1 not null, + tax_year_month date not null, + outer_request_id varchar2(50) not null, + tax_agent_id number not null +); +/ + +alter table hrsa_add_up_deduction_request add lock_version int; +/ + +alter table hrsa_add_up_deduction_request modify lock_version default 0; +/ + +create table hrsa_add_up_deduction_req_fail +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + request_id number not null, + employee_id number not null, + employee_type int not null, + tax_agent_id number not null, + reason varchar2(255) not null, + tax_year_month date not null, + outer_request_id varchar2(50) not null +); +/ + diff --git a/resource/sqlupgrade/JC/sql202309050103.sql b/resource/sqlupgrade/JC/sql202309050103.sql new file mode 100644 index 000000000..e9e5dfeee --- /dev/null +++ b/resource/sqlupgrade/JC/sql202309050103.sql @@ -0,0 +1,3 @@ +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 (706066600446312885, 1, 674916065864646661, 1, 0, 0, to_date('2022-05-05 16:30:11','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-05 16:30:11','yyyy-MM-dd HH24:mi:ss'), 0, 'all_teams', 703433961629614119, 5); +/ + diff --git a/resource/sqlupgrade/JC/sql202309050203.sql b/resource/sqlupgrade/JC/sql202309050203.sql new file mode 100644 index 000000000..4603c0e75 --- /dev/null +++ b/resource/sqlupgrade/JC/sql202309050203.sql @@ -0,0 +1,30 @@ +alter table hrsa_add_up_situation add add_up_taxable_income varchar2(255); +/ + +alter table hrsa_add_up_situation add actual_add_up_advance_tax varchar2(255); +/ + +alter table hrsa_add_up_situation add tax_adjustment varchar2(255); +/ + +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 (706066600446312885, 1, 674916065864646661, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 5); +/ + +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 (706066600446312886, 1, 674916065864646658, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 6); +/ + +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 (1693896072589, '当前累计减免税额合计', '备注', 'salary', 'salaryitem', 'formula', 'number', 'number', '{"isCustomFunction":"0","sqlReturnKey":"","openDecrypt":"0","datasource":{"datasourceId":""}}', '{薪资项目.本月(次)减免税额}+{往期累计情况.累计减免税额}', 'salaryItem_taxDeduction+addUpSituation_addUpTaxSavings', 27, 0, to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss')); +/ + +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 (1693896072606, '本月(次)减免税额', 1693896072589, 'salaryItem_taxDeduction', '{薪资项目.本月(次)减免税额}', 'number', 'salaryItem', 0, 27, 0, to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss')); +/ + +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 (1693896072611, '累计减免税额', 1693896072589, 'addUpSituation_addUpTaxSavings', '{往期累计情况.累计减免税额}', 'number', 'addUpSituation', 1, 27, 0, to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss')); +/ + +update hrsa_sys_salary_item set value_type = 2 ,formula_id =1693896072589 where id = 674916065864646658; +/ + +update hrsa_salary_item set value_type =2 ,formula_id =1693896072589 where sys_salary_item_id = 674916065864646658; +/ + diff --git a/resource/sqlupgrade/Mysql/sql202307100103.sql b/resource/sqlupgrade/Mysql/sql202307100103.sql deleted file mode 100644 index e69de29bb..000000000 diff --git a/resource/sqlupgrade/Mysql/sql202309040303.sql b/resource/sqlupgrade/Mysql/sql202309040303.sql new file mode 100644 index 000000000..09de22bfa --- /dev/null +++ b/resource/sqlupgrade/Mysql/sql202309040303.sql @@ -0,0 +1,39 @@ +create table hrsa_add_up_deduction_request +( + id bigint primary key comment 'ID' , + create_time datetime comment '创建时间' , + update_time datetime comment '修改时间' , + creator bigint comment '创建人id' , + delete_type int default 0 comment '是否删除' , + tenant_key varchar(10) comment '租户KEY' , + request_id bigint not null comment '查询请求ID' , + request_status tinyint(1) default 1 not null comment '请求处理状态:10待处理 20处理中 99已完成' , + tax_year_month datetime not null comment '税款所属期' , + outer_request_id varchar(50) not null comment '外部接口查询请求ID' , + tax_agent_id bigint not null comment '个税扣缴义务人Id' +) +; + +alter table hrsa_add_up_deduction_request add lock_version int +; + +alter table hrsa_add_up_deduction_request modify column lock_version int default 0 +; + +create table hrsa_add_up_deduction_req_fail +( + id bigint primary key comment 'ID' , + create_time datetime comment '创建时间' , + update_time datetime comment '修改时间' , + creator bigint comment '创建人id' , + delete_type int default 0 comment '是否删除' , + tenant_key varchar(10) comment '租户KEY' , + request_id bigint not null comment '查询请求ID' , + employee_id bigint not null comment '员工ID' , + employee_type int not null comment '员工类型' , + tax_agent_id bigint not null comment '个税扣缴义务人ID' , + reason varchar(255) not null comment '失败原因' , + tax_year_month datetime not null comment '税款所属期' , + outer_request_id varchar(50) not null comment '外部接口查询请求id' +) +; \ No newline at end of file diff --git a/resource/sqlupgrade/Mysql/sql202309050103.sql b/resource/sqlupgrade/Mysql/sql202309050103.sql new file mode 100644 index 000000000..67dd54d95 --- /dev/null +++ b/resource/sqlupgrade/Mysql/sql202309050103.sql @@ -0,0 +1 @@ +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 (706066600446312885, 1, 674916065864646661, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 5); \ No newline at end of file diff --git a/resource/sqlupgrade/Mysql/sql202309050203.sql b/resource/sqlupgrade/Mysql/sql202309050203.sql new file mode 100644 index 000000000..c5fce8081 --- /dev/null +++ b/resource/sqlupgrade/Mysql/sql202309050203.sql @@ -0,0 +1,19 @@ +alter table hrsa_add_up_situation add add_up_taxable_income varchar(255) +; +alter table hrsa_add_up_situation add actual_add_up_advance_tax varchar(255) +; +alter table hrsa_add_up_situation add tax_adjustment varchar(255) +; + +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 (706066600446312885, 1, 674916065864646661, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 5); +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 (706066600446312886, 1, 674916065864646658, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 6); + +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 (1693896072589, '当前累计减免税额合计', '备注', 'salary', 'salaryitem', 'formula', 'number', 'number', '{"isCustomFunction":"0","sqlReturnKey":"","openDecrypt":"0","datasource":{"datasourceId":""}}', '{薪资项目.本月(次)减免税额}+{往期累计情况.累计减免税额}', 'salaryItem_taxDeduction+addUpSituation_addUpTaxSavings', 27, 0, '2023-09-05 14:41:12', '2023-09-05 14:41:12'); + +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 (1693896072606, '本月(次)减免税额', 1693896072589, 'salaryItem_taxDeduction', '{薪资项目.本月(次)减免税额}', 'number', 'salaryItem', 0, 27, 0, '2023-09-05 14:41:12', '2023-09-05 14:41:12'); + +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 (1693896072611, '累计减免税额', 1693896072589, 'addUpSituation_addUpTaxSavings', '{往期累计情况.累计减免税额}', 'number', 'addUpSituation', 1, 27, 0, '2023-09-05 14:41:12', '2023-09-05 14:41:12'); + +update hrsa_sys_salary_item set value_type = 2 ,formula_id =1693896072589 where id = 674916065864646658; + +update hrsa_salary_item set value_type =2 ,formula_id =1693896072589 where sys_salary_item_id = 674916065864646658; \ No newline at end of file diff --git a/resource/sqlupgrade/Oracle/sql202307100103.sql b/resource/sqlupgrade/Oracle/sql202307100103.sql deleted file mode 100644 index e69de29bb..000000000 diff --git a/resource/sqlupgrade/Oracle/sql202309040303.sql b/resource/sqlupgrade/Oracle/sql202309040303.sql new file mode 100644 index 000000000..1e666275e --- /dev/null +++ b/resource/sqlupgrade/Oracle/sql202309040303.sql @@ -0,0 +1,39 @@ +create table hrsa_add_up_deduction_request +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + request_id number not null, + request_status number default 1 not null, + tax_year_month date not null, + outer_request_id varchar2(50) not null, + tax_agent_id number not null +) +/ + +alter table hrsa_add_up_deduction_request add lock_version int +/ + +alter table hrsa_add_up_deduction_request modify lock_version default 0 +/ + +create table hrsa_add_up_deduction_req_fail +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + request_id number not null, + employee_id number not null, + employee_type int not null, + tax_agent_id number not null, + reason varchar2(255) not null, + tax_year_month date not null, + outer_request_id varchar2(50) not null +) +/ \ No newline at end of file diff --git a/resource/sqlupgrade/Oracle/sql202309050103.sql b/resource/sqlupgrade/Oracle/sql202309050103.sql new file mode 100644 index 000000000..c010cb4ef --- /dev/null +++ b/resource/sqlupgrade/Oracle/sql202309050103.sql @@ -0,0 +1,2 @@ +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 (706066600446312885, 1, 674916065864646661, 1, 0, 0, to_date('2022-05-05 16:30:11','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-05 16:30:11','yyyy-MM-dd HH24:mi:ss'), 0, 'all_teams', 703433961629614119, 5) +/ \ No newline at end of file diff --git a/resource/sqlupgrade/Oracle/sql202309050203.sql b/resource/sqlupgrade/Oracle/sql202309050203.sql new file mode 100644 index 000000000..62458bdf3 --- /dev/null +++ b/resource/sqlupgrade/Oracle/sql202309050203.sql @@ -0,0 +1,23 @@ +alter table hrsa_add_up_situation add add_up_taxable_income varchar2(255) +/ +alter table hrsa_add_up_situation add actual_add_up_advance_tax varchar2(255) +/ +alter table hrsa_add_up_situation add tax_adjustment varchar2(255) +/ +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 (706066600446312885, 1, 674916065864646661, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 5) +/ +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 (706066600446312886, 1, 674916065864646658, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 6) +/ + +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 (1693896072589, '当前累计减免税额合计', '备注', 'salary', 'salaryitem', 'formula', 'number', 'number', '{"isCustomFunction":"0","sqlReturnKey":"","openDecrypt":"0","datasource":{"datasourceId":""}}', '{薪资项目.本月(次)减免税额}+{往期累计情况.累计减免税额}', 'salaryItem_taxDeduction+addUpSituation_addUpTaxSavings', 27, 0, to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss')) +/ +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 (1693896072606, '本月(次)减免税额', 1693896072589, 'salaryItem_taxDeduction', '{薪资项目.本月(次)减免税额}', 'number', 'salaryItem', 0, 27, 0, to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss')) +/ +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 (1693896072611, '累计减免税额', 1693896072589, 'addUpSituation_addUpTaxSavings', '{往期累计情况.累计减免税额}', 'number', 'addUpSituation', 1, 27, 0, to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss')) +/ + +update hrsa_sys_salary_item set value_type = 2 ,formula_id =1693896072589 where id = 674916065864646658 +/ + +update hrsa_salary_item set value_type =2 ,formula_id =1693896072589 where sys_salary_item_id = 674916065864646658 +/ \ No newline at end of file diff --git a/resource/sqlupgrade/PG/sql202309040303.sql b/resource/sqlupgrade/PG/sql202309040303.sql new file mode 100644 index 000000000..eefe81ecd --- /dev/null +++ b/resource/sqlupgrade/PG/sql202309040303.sql @@ -0,0 +1,40 @@ +create table hrsa_add_up_deduction_request +( + id bigint primary key , + create_time timestamp, + update_time timestamp, + creator bigint, + delete_type int default 0, + tenant_key varchar(10), + request_id bigint not null, + request_status smallint default 1 not null, + tax_year_month timestamp not null, + outer_request_id varchar(50) not null, + tax_agent_id bigint not null +); +/ + +alter table hrsa_add_up_deduction_request add lock_version int; +/ + +alter table hrsa_add_up_deduction_request alter column lock_version set default 0; +/ + + +create table hrsa_add_up_deduction_req_fail +( + id bigint primary key , + create_time timestamp, + update_time timestamp, + creator bigint, + delete_type int default 0, + tenant_key varchar(10), + request_id bigint not null, + employee_id bigint not null, + employee_type int not null, + tax_agent_id bigint not null, + reason varchar(255) not null, + tax_year_month timestamp not null, + outer_request_id varchar(50) not null +); +/ \ No newline at end of file diff --git a/resource/sqlupgrade/PG/sql202309050103.sql b/resource/sqlupgrade/PG/sql202309050103.sql new file mode 100644 index 000000000..442635f18 --- /dev/null +++ b/resource/sqlupgrade/PG/sql202309050103.sql @@ -0,0 +1,2 @@ +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 (706066600446312885, 1, 674916065864646661, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 5); +/ \ No newline at end of file diff --git a/resource/sqlupgrade/PG/sql202309050203.sql b/resource/sqlupgrade/PG/sql202309050203.sql new file mode 100644 index 000000000..50cbec61f --- /dev/null +++ b/resource/sqlupgrade/PG/sql202309050203.sql @@ -0,0 +1,25 @@ +alter table hrsa_add_up_situation add add_up_taxable_income varchar(255) +/ +alter table hrsa_add_up_situation add actual_add_up_advance_tax varchar(255) +/ +alter table hrsa_add_up_situation add tax_adjustment varchar(255) +/ +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 (706066600446312885, 1, 674916065864646661, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 5) +/ +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 (706066600446312886, 1, 674916065864646658, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 6) +/ + +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 (1693896072589, '当前累计减免税额合计', '备注', 'salary', 'salaryitem', 'formula', 'number', 'number', '{"isCustomFunction":"0","sqlReturnKey":"","openDecrypt":"0","datasource":{"datasourceId":""}}', '{薪资项目.本月(次)减免税额}+{往期累计情况.累计减免税额}', 'salaryItem_taxDeduction+addUpSituation_addUpTaxSavings', 27, 0, '2023-09-05 14:41:12', '2023-09-05 14:41:12') +/ + +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 (1693896072606, '本月(次)减免税额', 1693896072589, 'salaryItem_taxDeduction', '{薪资项目.本月(次)减免税额}', 'number', 'salaryItem', 0, 27, 0, '2023-09-05 14:41:12', '2023-09-05 14:41:12') +/ + +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 (1693896072611, '累计减免税额', 1693896072589, 'addUpSituation_addUpTaxSavings', '{往期累计情况.累计减免税额}', 'number', 'addUpSituation', 1, 27, 0, '2023-09-05 14:41:12', '2023-09-05 14:41:12') +/ + +update hrsa_sys_salary_item set value_type = 2 ,formula_id =1693896072589 where id = 674916065864646658 +/ + +update hrsa_salary_item set value_type =2 ,formula_id =1693896072589 where sys_salary_item_id = 674916065864646658 +/ \ No newline at end of file diff --git a/resource/sqlupgrade/SQLServer/sql202307100103.sql b/resource/sqlupgrade/SQLServer/sql202307100103.sql deleted file mode 100644 index e69de29bb..000000000 diff --git a/resource/sqlupgrade/SQLServer/sql202309040303.sql b/resource/sqlupgrade/SQLServer/sql202309040303.sql new file mode 100644 index 000000000..bdfa19c5f --- /dev/null +++ b/resource/sqlupgrade/SQLServer/sql202309040303.sql @@ -0,0 +1,39 @@ +create table hrsa_add_up_deduction_request +( + id bigint primary key , + create_time datetime, + update_time datetime, + creator bigint, + delete_type int default 0, + tenant_key nvarchar(10), + request_id bigint not null, + request_status tinyint default 1 not null, + tax_year_month datetime not null, + outer_request_id nvarchar(50) not null, + tax_agent_id bigint not null +) +GO + +alter table hrsa_add_up_deduction_request add lock_version int +GO + +alter table hrsa_add_up_deduction_request add constraint df_lock_version_71db6820 default 0 for lock_version +GO + +create table hrsa_add_up_deduction_req_fail +( + id bigint primary key , + create_time datetime, + update_time datetime, + creator bigint, + delete_type int default 0, + tenant_key nvarchar(10), + request_id bigint not null, + employee_id bigint not null, + employee_type int not null, + tax_agent_id bigint not null, + reason nvarchar(255) not null, + tax_year_month datetime not null, + outer_request_id nvarchar(50) not null +) +GO \ No newline at end of file diff --git a/resource/sqlupgrade/SQLServer/sql202309050103.sql b/resource/sqlupgrade/SQLServer/sql202309050103.sql new file mode 100644 index 000000000..362f2654c --- /dev/null +++ b/resource/sqlupgrade/SQLServer/sql202309050103.sql @@ -0,0 +1,2 @@ +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 (706066600446312885, 1, 674916065864646661, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 5) +GO \ No newline at end of file diff --git a/resource/sqlupgrade/SQLServer/sql202309050203.sql b/resource/sqlupgrade/SQLServer/sql202309050203.sql new file mode 100644 index 000000000..7e102b81a --- /dev/null +++ b/resource/sqlupgrade/SQLServer/sql202309050203.sql @@ -0,0 +1,25 @@ +alter table hrsa_add_up_situation add add_up_taxable_income nvarchar(255) +GO +alter table hrsa_add_up_situation add actual_add_up_advance_tax nvarchar(255) +GO +alter table hrsa_add_up_situation add tax_adjustment nvarchar(255) +GO + +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 (706066600446312885, 1, 674916065864646661, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 5) +GO + +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 (706066600446312886, 1, 674916065864646658, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 6) +GO + +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 (1693896072589, '当前累计减免税额合计', '备注', 'salary', 'salaryitem', 'formula', 'number', 'number', '{"isCustomFunction":"0","sqlReturnKey":"","openDecrypt":"0","datasource":{"datasourceId":""}}', '{薪资项目.本月(次)减免税额}+{往期累计情况.累计减免税额}', 'salaryItem_taxDeduction+addUpSituation_addUpTaxSavings', 27, 0, '2023-09-05 14:41:12', '2023-09-05 14:41:12') +GO +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 (1693896072606, '本月(次)减免税额', 1693896072589, 'salaryItem_taxDeduction', '{薪资项目.本月(次)减免税额}', 'number', 'salaryItem', 0, 27, 0, '2023-09-05 14:41:12', '2023-09-05 14:41:12') +GO +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 (1693896072611, '累计减免税额', 1693896072589, 'addUpSituation_addUpTaxSavings', '{往期累计情况.累计减免税额}', 'number', 'addUpSituation', 1, 27, 0, '2023-09-05 14:41:12', '2023-09-05 14:41:12') +GO + +update hrsa_sys_salary_item set value_type = 2 ,formula_id =1693896072589 where id = 674916065864646658 +GO + +update hrsa_salary_item set value_type =2 ,formula_id =1693896072589 where sys_salary_item_id = 674916065864646658 +GO \ No newline at end of file diff --git a/resource/sqlupgrade/ST/sql202307100103.sql b/resource/sqlupgrade/ST/sql202307100103.sql deleted file mode 100644 index e69de29bb..000000000 diff --git a/resource/sqlupgrade/ST/sql202309040303.sql b/resource/sqlupgrade/ST/sql202309040303.sql new file mode 100644 index 000000000..5805822bc --- /dev/null +++ b/resource/sqlupgrade/ST/sql202309040303.sql @@ -0,0 +1,40 @@ +create table hrsa_add_up_deduction_request +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + request_id number not null, + request_status number default 1 not null, + tax_year_month date not null, + outer_request_id varchar2(50) not null, + tax_agent_id number not null +); +/ + +alter table hrsa_add_up_deduction_request add lock_version int; +/ + +alter table hrsa_add_up_deduction_request modify lock_version default 0; +/ + +create table hrsa_add_up_deduction_req_fail +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + request_id number not null, + employee_id number not null, + employee_type int not null, + tax_agent_id number not null, + reason varchar2(255) not null, + tax_year_month date not null, + outer_request_id varchar2(50) not null +); +/ + diff --git a/resource/sqlupgrade/ST/sql202309050103.sql b/resource/sqlupgrade/ST/sql202309050103.sql new file mode 100644 index 000000000..e9e5dfeee --- /dev/null +++ b/resource/sqlupgrade/ST/sql202309050103.sql @@ -0,0 +1,3 @@ +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 (706066600446312885, 1, 674916065864646661, 1, 0, 0, to_date('2022-05-05 16:30:11','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-05 16:30:11','yyyy-MM-dd HH24:mi:ss'), 0, 'all_teams', 703433961629614119, 5); +/ + diff --git a/resource/sqlupgrade/ST/sql202309050203.sql b/resource/sqlupgrade/ST/sql202309050203.sql new file mode 100644 index 000000000..4603c0e75 --- /dev/null +++ b/resource/sqlupgrade/ST/sql202309050203.sql @@ -0,0 +1,30 @@ +alter table hrsa_add_up_situation add add_up_taxable_income varchar2(255); +/ + +alter table hrsa_add_up_situation add actual_add_up_advance_tax varchar2(255); +/ + +alter table hrsa_add_up_situation add tax_adjustment varchar2(255); +/ + +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 (706066600446312885, 1, 674916065864646661, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 5); +/ + +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 (706066600446312886, 1, 674916065864646658, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 6); +/ + +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 (1693896072589, '当前累计减免税额合计', '备注', 'salary', 'salaryitem', 'formula', 'number', 'number', '{"isCustomFunction":"0","sqlReturnKey":"","openDecrypt":"0","datasource":{"datasourceId":""}}', '{薪资项目.本月(次)减免税额}+{往期累计情况.累计减免税额}', 'salaryItem_taxDeduction+addUpSituation_addUpTaxSavings', 27, 0, to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss')); +/ + +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 (1693896072606, '本月(次)减免税额', 1693896072589, 'salaryItem_taxDeduction', '{薪资项目.本月(次)减免税额}', 'number', 'salaryItem', 0, 27, 0, to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss')); +/ + +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 (1693896072611, '累计减免税额', 1693896072589, 'addUpSituation_addUpTaxSavings', '{往期累计情况.累计减免税额}', 'number', 'addUpSituation', 1, 27, 0, to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss')); +/ + +update hrsa_sys_salary_item set value_type = 2 ,formula_id =1693896072589 where id = 674916065864646658; +/ + +update hrsa_salary_item set value_type =2 ,formula_id =1693896072589 where sys_salary_item_id = 674916065864646658; +/ + diff --git a/src/com/engine/salary/constant/SzyhApiConstant.java b/src/com/engine/salary/constant/SzyhApiConstant.java index 698f662f8..b4e04552a 100644 --- a/src/com/engine/salary/constant/SzyhApiConstant.java +++ b/src/com/engine/salary/constant/SzyhApiConstant.java @@ -137,6 +137,10 @@ public class SzyhApiConstant { * 鍒锋柊缂存鐘舵 */ public static final String GET_SYNC_WITHHOLDING_FEEDBACK = "gateway/iit/payment/getSyncWithholdingFeedback"; + /** + * 浼佷笟鐢虫姤鏁版嵁鏄庣粏鏌ヨ + */ + public static final String GET_COMPANY_INCOMES = "gateway/iit/report/getCompanyIncomes"; /** diff --git a/src/com/engine/salary/entity/datacollection/AddUpSituation.java b/src/com/engine/salary/entity/datacollection/AddUpSituation.java index eeae5d130..5771dabf0 100644 --- a/src/com/engine/salary/entity/datacollection/AddUpSituation.java +++ b/src/com/engine/salary/entity/datacollection/AddUpSituation.java @@ -4,6 +4,7 @@ import com.engine.salary.annotation.Encrypt; import com.engine.salary.annotation.SalaryFormulaVar; import com.engine.salary.annotation.SalaryTable; import com.engine.salary.annotation.SalaryTableOperate; +import com.engine.salary.enums.datacollection.DataCollectionEmployeeTypeEnum; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -49,6 +50,12 @@ public class AddUpSituation { */ private Integer year; + /** + * 浜哄憳绫诲瀷 + * @see DataCollectionEmployeeTypeEnum + */ + private Integer employeeType; + /** * 绱鏀跺叆棰 */ @@ -80,57 +87,65 @@ public class AddUpSituation { /** * 绱瀛愬コ鏁欒偛 */ - @SalaryFormulaVar(defaultLabel = "绱瀛愬コ鏁欒偛", labelId = 86321, dataType = "number") +// @SalaryFormulaVar(defaultLabel = "绱瀛愬コ鏁欒偛", labelId = 86321, dataType = "number") @Encrypt + @Deprecated private String addUpChildEducation; /** * 绱缁х画鏁欒偛 */ - @SalaryFormulaVar(defaultLabel = "绱缁х画鏁欒偛", labelId = 86323, dataType = "number") +// @SalaryFormulaVar(defaultLabel = "绱缁х画鏁欒偛", labelId = 86323, dataType = "number") @Encrypt + @Deprecated private String addUpContinuingEducation; /** * 绱浣忔埧璐锋鍒╂伅 */ - @SalaryFormulaVar(defaultLabel = "绱浣忔埧璐锋鍒╂伅", labelId = 86324, dataType = "number") +// @SalaryFormulaVar(defaultLabel = "绱浣忔埧璐锋鍒╂伅", labelId = 86324, dataType = "number") @Encrypt + @Deprecated private String addUpHousingLoanInterest; /** * 绱浣忔埧绉熼噾 */ - @SalaryFormulaVar(defaultLabel = "绱浣忔埧绉熼噾", labelId = 86325, dataType = "number") +// @SalaryFormulaVar(defaultLabel = "绱浣忔埧绉熼噾", labelId = 86325, dataType = "number") @Encrypt + @Deprecated private String addUpHousingRent; /** * 绱璧″吇鑰佷汉 */ - @SalaryFormulaVar(defaultLabel = "绱璧″吇鑰佷汉", labelId = 86326, dataType = "number") +// @SalaryFormulaVar(defaultLabel = "绱璧″吇鑰佷汉", labelId = 86326, dataType = "number") @Encrypt + @Deprecated private String addUpSupportElderly; /** * 绱澶х梾鍖荤枟 */ - @SalaryFormulaVar(defaultLabel = "绱澶х梾鍖荤枟", labelId = 105142, dataType = "number") +// @SalaryFormulaVar(defaultLabel = "绱澶х梾鍖荤枟", labelId = 105142, dataType = "number") @Encrypt + @Deprecated private String addUpIllnessMedical; /** * 绱濠村辜鍎跨収鎶 */ - @SalaryFormulaVar(defaultLabel = "绱濠村辜鍎跨収鎶", labelId = 117732, dataType = "number") +// @SalaryFormulaVar(defaultLabel = "绱濠村辜鍎跨収鎶", labelId = 117732, dataType = "number") @Encrypt + @Deprecated private String addUpInfantCare; /** * 绱濠村辜鍎跨収鎶 */ - @SalaryFormulaVar(defaultLabel = "绱涓汉鍏昏侀噾", labelId = 117732, dataType = "number") +// @SalaryFormulaVar(defaultLabel = "绱涓汉鍏昏侀噾", labelId = 117732, dataType = "number") @Encrypt + @Deprecated private String addUpPrivatePension; /** @@ -175,6 +190,27 @@ public class AddUpSituation { @Encrypt private String addUpAdvanceTax; + /** + * 瀹為檯绱宸查鎵i缂寸◣棰 + */ + @SalaryFormulaVar(defaultLabel = "瀹為檯绱宸查鎵i缂寸◣棰", labelId = 233557, dataType = "number") + @Encrypt + private String actualAddUpAdvanceTax; + + /** + * 涓◣璋冨樊 + */ + @SalaryFormulaVar(defaultLabel = "涓◣璋冨樊", labelId = 233559, dataType = "number") + @Encrypt + private String taxAdjustment; + + /** + * 绱搴旂撼绋庢墍寰楅 + */ + @SalaryFormulaVar(defaultLabel = "绱搴旂撼绋庢墍寰楅", labelId = 85371, dataType = "number") + @Encrypt + private String addUpTaxableIncome; + /** * 鍒涘缓鏃堕棿 */ diff --git a/src/com/engine/salary/entity/datacollection/bo/DataCollectionBO.java b/src/com/engine/salary/entity/datacollection/bo/DataCollectionBO.java index db9a2241d..46cd04e6d 100644 --- a/src/com/engine/salary/entity/datacollection/bo/DataCollectionBO.java +++ b/src/com/engine/salary/entity/datacollection/bo/DataCollectionBO.java @@ -1,15 +1,28 @@ package com.engine.salary.entity.datacollection.bo; +import com.engine.salary.entity.datacollection.AddUpDeduction; +import com.engine.salary.entity.datacollection.dto.AddUpDeductionRequestResultDTO; +import com.engine.salary.entity.datacollection.po.AddUpDeductionRequestFailPO; +import com.engine.salary.entity.datacollection.po.AddUpDeductionRequestPO; +import com.engine.salary.entity.datacollection.response.QuerySpecialAmountFeedbackResponse; +import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO; import com.engine.salary.entity.taxagent.po.TaxAgentTaxReturnPO; import com.engine.salary.enums.SalaryOnOffEnum; +import com.engine.salary.enums.employeedeclare.CardTypeEnum; +import com.engine.salary.enums.employeedeclare.EmploymentStatusEnum; +import com.engine.salary.enums.employeedeclare.EmploymentTypeEnum; +import com.engine.salary.enums.employeedeclare.GenderEnum; +import com.engine.salary.enums.sicategory.DeleteTypeEnum; import com.engine.salary.enums.taxagent.TaxAgentTaxReturnPasswordTypeEnum; +import com.engine.salary.service.impl.AddUpDeductionServiceImpl; +import com.engine.salary.util.SalaryDateUtil; +import com.engine.salary.util.SalaryI18nUtil; import dm.jdbc.util.IdGenerator; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.HashMap; -import java.util.Map; +import java.util.*; /** * @Description: 鏁版嵁閲囬泦 @@ -318,79 +331,80 @@ public class DataCollectionBO { return requestParam; } -// public static List> getEmployeeList(List declarePOList) { -// List> employeeList = new ArrayList<>(); -// for (EmployeeDeclarePO employeeDeclarePO : declarePOList) { -// Map employeeMap = new HashMap<>(32); -// employeeMap.put("xm", employeeDeclarePO.getEmployeeName()); -// employeeMap.put("zzlx", CardTypeEnum.RESIDENT_IDENTITY_CARDS.getDefaultLabel()); -// employeeMap.put("zzhm", employeeDeclarePO.getCardNum()); -// employeeMap.put("lxdh", employeeDeclarePO.getMobile()); -// employeeMap.put("nsrzt", EmploymentStatusEnum.NORMAL.getDefaultLabel()); -// employeeMap.put("sfgy", EmploymentTypeEnum.EMPLOYEE.getDefaultLabel()); -// employeeMap.put("rzsgrq", SalaryDateUtil.DATE_FORMATTER.format(employeeDeclarePO.getEmploymentDate())); -// employeeMap.put("xb", GenderEnum.MALE.getValue().equals(employeeDeclarePO.getGender()) ? GenderEnum.MALE.getDefaultLabel() : GenderEnum.FEMALE.getDefaultLabel()); -// employeeMap.put("csny", SalaryDateUtil.DATE_FORMATTER.format(employeeDeclarePO.getBirthday())); -// employeeMap.put("gj", "涓浗"); -// employeeMap.put("rydq", "澧冨唴"); -// boolean disability = SalaryOnOffEnum.ON.getValue().equals(employeeDeclarePO.getDisability()); -// boolean martyrDependents = SalaryOnOffEnum.ON.getValue().equals(employeeDeclarePO.getMartyrDependents()); -// employeeMap.computeIfAbsent("sfcj", e -> SalaryOnOffEnum.parseByValue(employeeDeclarePO.getDisability()).getDefaultLabel()); -// employeeMap.computeIfAbsent("cjzh", e -> disability ? employeeDeclarePO.getDisabilityCardNo() : null); -// employeeMap.computeIfAbsent("sfls", e->SalaryOnOffEnum.parseByValue(employeeDeclarePO.getMartyrDependents()).getDefaultLabel()); -// employeeMap.computeIfAbsent("lszh", e-> martyrDependents ? employeeDeclarePO.getMartyrDependentsCardNo() : null); -// employeeMap.computeIfAbsent("sfgl", e -> SalaryOnOffEnum.parseByValue(employeeDeclarePO.getLonelyOld()).getDefaultLabel()); -// employeeMap.computeIfAbsent("sfzdw", e -> SalaryOnOffEnum.parseByValue(employeeDeclarePO.getDeductExpenses()).getDefaultLabel()); -// employeeList.add(employeeMap); -// } -// return employeeList; -// } -// -// public static AddUpDeduction buildAddUpDeductionPO(QuerySpecialAmountFeedbackResponse.Feedback feedback) { -// return AddUpDeduction.builder() -// .id(IdGenerator.generate()) -// .addUpChildEducation(feedback.getLjznjyzc().toString()) -// .addUpContinuingEducation(feedback.getLjjxjyzc().toString()) -// .addUpHousingRent(feedback.getLjzfzjzc().toString()) -// .addUpInfantCare(feedback.getLjyyezhzc().toString()) -// .addUpHousingLoanInterest(feedback.getLjzfdklxzc().toString()) -// .addUpSupportElderly(feedback.getLjsylrzc().toString()) -// .addUpIllnessMedical("0") + public static List> getEmployeeList(List declarePOList) { + List> employeeList = new ArrayList<>(); + for (EmployeeDeclarePO employeeDeclarePO : declarePOList) { + Map employeeMap = new HashMap<>(32); + employeeMap.put("xm", employeeDeclarePO.getEmployeeName()); + employeeMap.put("zzlx", CardTypeEnum.RESIDENT_IDENTITY_CARDS.getDefaultLabel()); + employeeMap.put("zzhm", employeeDeclarePO.getCardNum()); + employeeMap.put("lxdh", employeeDeclarePO.getMobile()); + employeeMap.put("nsrzt", EmploymentStatusEnum.NORMAL.getDefaultLabel()); + employeeMap.put("sfgy", EmploymentTypeEnum.EMPLOYEE.getDefaultLabel()); + employeeMap.put("rzsgrq", SalaryDateUtil.getFormatYYYYMM(employeeDeclarePO.getEmploymentDate())); + employeeMap.put("xb", GenderEnum.MALE.getValue().equals(employeeDeclarePO.getGender()) ? GenderEnum.MALE.getDefaultLabel() : GenderEnum.FEMALE.getDefaultLabel()); + employeeMap.put("csny", SalaryDateUtil.getFormatYYYYMM(employeeDeclarePO.getBirthday())); + employeeMap.put("gj", "涓浗"); + employeeMap.put("rydq", "澧冨唴"); + boolean disability = SalaryOnOffEnum.ON.getValue().equals(employeeDeclarePO.getDisability()); + boolean martyrDependents = SalaryOnOffEnum.ON.getValue().equals(employeeDeclarePO.getMartyrDependents()); + employeeMap.computeIfAbsent("sfcj", e -> SalaryOnOffEnum.parseByValue(employeeDeclarePO.getDisability()).getDefaultLabel()); + employeeMap.computeIfAbsent("cjzh", e -> disability ? employeeDeclarePO.getDisabilityCardNo() : null); + employeeMap.computeIfAbsent("sfls", e -> SalaryOnOffEnum.parseByValue(employeeDeclarePO.getMartyrDependents()).getDefaultLabel()); + employeeMap.computeIfAbsent("lszh", e -> martyrDependents ? employeeDeclarePO.getMartyrDependentsCardNo() : null); + employeeMap.computeIfAbsent("sfgl", e -> SalaryOnOffEnum.parseByValue(employeeDeclarePO.getLonelyOld()).getDefaultLabel()); + employeeMap.computeIfAbsent("sfzdw", e -> SalaryOnOffEnum.parseByValue(employeeDeclarePO.getDeductExpenses()).getDefaultLabel()); + employeeList.add(employeeMap); + } + return employeeList; + } + + public static AddUpDeduction buildAddUpDeductionPO(QuerySpecialAmountFeedbackResponse.Feedback feedback) { + return AddUpDeduction.builder() + .id(IdGenerator.generate()) + .addUpChildEducation(feedback.getLjznjyzc().toString()) + .addUpContinuingEducation(feedback.getLjjxjyzc().toString()) + .addUpHousingRent(feedback.getLjzfzjzc().toString()) + .addUpInfantCare(feedback.getLjyyezhzc().toString()) + .addUpHousingLoanInterest(feedback.getLjzfdklxzc().toString()) + .addUpSupportElderly(feedback.getLjsylrzc().toString()) + .addUpIllnessMedical("0") // .dataSource(EnumAddUpDeductionDataSource.ONLINE.getValue()) // .lastUpdateTime(LocalDateTime.now()) -// .updateTime(LocalDateTime.now()) -// .build(); -// } -// -// public static AddUpDeductionRequestFailPO buildAddUpDeductionRequestFailPO(AddUpDeductionServiceImpl.AddUpDeductionOnlineRequestWrapper requestWrapper, -// AddUpDeductionRequestPO requestPO, -// Long employeeId) { -// return AddUpDeductionRequestFailPO.builder() -// .id(IdGenerator.generate()) -// .requestId(requestPO.getRequestId()) -// .outerRequestId(requestPO.getOuterRequestId()) -// .taxYearMonth(requestPO.getTaxYearMonth()) -// .taxAgentId(requestPO.getTaxAgentId()) -// .employeeId(Optional.ofNullable(employeeId).orElse(0L)) -// .createTime(LocalDateTime.now()) -// .updateTime(LocalDateTime.now()) -// .deleteType(DeleteTypeEnum.NOT_DELETED.getValue()) -// .creator(requestWrapper.getCurrentEmployeeId()) -// .tenantKey(requestPO.getTenantKey()) -// .build(); -// } -// -// public static AddUpDeductionRequestResultDTO buildRequestResultDTO(Long requestId, AddUpDeductionServiceImpl.AddUpDeductionOnlineRequestWrapper requestWrapper) { -// return AddUpDeductionRequestResultDTO.builder() -// .requestId(requestId.toString()) -// .msg(String.format(SalaryI18nUtil.getI18nLabel(184070, "鍏辨垚鍔熻幏鍙栨暟鎹%s鏉★紝澶辫触%s鏉"), -// requestWrapper.getInsertList().size() + requestWrapper.getUpdateList().size(), -// requestWrapper.getFailPOList().size())) -// .result(requestWrapper.getFailPOList().size() > 0 ? "warning" : "success") -// .finish(true) -// .build(); -// } -// + .updateTime(new Date()) + .build(); + } + + public static AddUpDeductionRequestFailPO buildAddUpDeductionRequestFailPO(AddUpDeductionServiceImpl.AddUpDeductionOnlineRequestWrapper requestWrapper, + AddUpDeductionRequestPO requestPO, + Long employeeId) { + Date now = new Date(); + return AddUpDeductionRequestFailPO.builder() + .id(IdGenerator.generate()) + .requestId(requestPO.getRequestId()) + .outerRequestId(requestPO.getOuterRequestId()) + .taxYearMonth(requestPO.getTaxYearMonth()) + .taxAgentId(requestPO.getTaxAgentId()) + .employeeId(employeeId) + .createTime(now) + .updateTime(now) + .deleteType(DeleteTypeEnum.NOT_DELETED.getValue()) + .creator(requestWrapper.getCurrentEmployeeId()) + .tenantKey(requestPO.getTenantKey()) + .build(); + } + + public static AddUpDeductionRequestResultDTO buildRequestResultDTO(Long requestId, AddUpDeductionServiceImpl.AddUpDeductionOnlineRequestWrapper requestWrapper) { + return AddUpDeductionRequestResultDTO.builder() + .requestId(requestId.toString()) + .msg(String.format(SalaryI18nUtil.getI18nLabel(184070, "鍏辨垚鍔熻幏鍙栨暟鎹%s鏉★紝澶辫触%s鏉"), + requestWrapper.getInsertList().size() + requestWrapper.getUpdateList().size(), + requestWrapper.getFailPOList().size())) + .result(requestWrapper.getFailPOList().size() > 0 ? "warning" : "success") + .finish(true) + .build(); + } + // public static AddUpDeduction buildAddUpDeductionPO(AddUpDeductionSaveParam saveParam, Long currentEmployeeId, String currentTenantKey) { // return AddUpDeduction.builder() // .id(IdGenerator.generate()) diff --git a/src/com/engine/salary/entity/datacollection/dto/AddUpDeductionRequestFailListDTO.java b/src/com/engine/salary/entity/datacollection/dto/AddUpDeductionRequestFailListDTO.java new file mode 100644 index 000000000..df82a8178 --- /dev/null +++ b/src/com/engine/salary/entity/datacollection/dto/AddUpDeductionRequestFailListDTO.java @@ -0,0 +1,57 @@ +package com.engine.salary.entity.datacollection.dto; + +import com.engine.salary.annotation.SalaryTableColumn; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + + +/** + * 鏁版嵁閲囬泦-绱涓撻」闄勫姞鎵i櫎-鍦ㄧ嚎鑾峰彇澶辫触鍒楄〃 + * + * @author chengliming + * @date 2022-11-07 15:01:25 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("鏁版嵁閲囬泦-绱涓撻」闄勫姞鎵i櫎-鍦ㄧ嚎鑾峰彇澶辫触鍒楄〃") +public class AddUpDeductionRequestFailListDTO { + + @SalaryTableColumn(text = "濮撳悕", labelId = 85429, width = "100") + @ApiModelProperty("濮撳悕") + private String employeeName; + + @ApiModelProperty("鍛樺伐id") + private Long employeeId; + + @ApiModelProperty("id涓婚敭") + private String id; + + @ApiModelProperty("浜哄憳绫诲瀷") + private String employeeType; + + @SalaryTableColumn(text = "涓◣鎵g即涔夊姟浜", labelId = 86184, width = "150") + @ApiModelProperty("涓◣鎵g即涔夊姟浜") + private String taxAgentName; + + @SalaryTableColumn(text = "宸ュ彿", labelId = 86317, width = "100") + @ApiModelProperty("宸ュ彿") + private String jobNum; + + @SalaryTableColumn(text = "閮ㄩ棬", labelId = 86185, width = "100") + @ApiModelProperty("閮ㄩ棬") + private String departmentName; + + @SalaryTableColumn(text = "韬唤璇佷欢鍙风爜", labelId = 102782, width = "150") + @ApiModelProperty("璇佷欢鍙风爜") + private String idNo; + + @SalaryTableColumn(text = "澶辫触鍘熷洜", labelId = 144832, width = "600") + @ApiModelProperty("澶辫触鍘熷洜") + private String failReason; +} diff --git a/src/com/engine/salary/entity/datacollection/dto/AddUpDeductionRequestResultDTO.java b/src/com/engine/salary/entity/datacollection/dto/AddUpDeductionRequestResultDTO.java new file mode 100644 index 000000000..5ef39f2e0 --- /dev/null +++ b/src/com/engine/salary/entity/datacollection/dto/AddUpDeductionRequestResultDTO.java @@ -0,0 +1,34 @@ +package com.engine.salary.entity.datacollection.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + + +/** + * 鏁版嵁閲囬泦-绱涓撻」闄勫姞鎵i櫎-鍦ㄧ嚎鑾峰彇缁撴灉 + * + * @author chengliming + * @date 2022-11-01 09:47:27 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +@ApiModel("鏁版嵁閲囬泦-绱涓撻」闄勫姞鎵i櫎-鍦ㄧ嚎鑾峰彇缁撴灉") +public class AddUpDeductionRequestResultDTO { + @ApiModelProperty("璇锋眰id") + private String requestId; + + @ApiModelProperty("鎻愮ず璇") + private String msg; + + @ApiModelProperty("澶勭悊缁撴灉") + private String result; + + @ApiModelProperty("鏄惁缁撴潫杞") + private Boolean finish; +} diff --git a/src/com/engine/salary/entity/datacollection/dto/AddUpSituationDTO.java b/src/com/engine/salary/entity/datacollection/dto/AddUpSituationDTO.java index fd217469e..0d31ad308 100644 --- a/src/com/engine/salary/entity/datacollection/dto/AddUpSituationDTO.java +++ b/src/com/engine/salary/entity/datacollection/dto/AddUpSituationDTO.java @@ -23,7 +23,6 @@ import lombok.NoArgsConstructor; public class AddUpSituationDTO { //涓婚敭id @JsonSerialize(using = ToStringSerializer.class) - @SalaryTableColumn(column = "id", display = false) private Long id; //鍛樺伐id @@ -36,7 +35,6 @@ public class AddUpSituationDTO { private Integer month; //濮撳悕 - @SalaryTableColumn(text = "濮撳悕", width = "10%", column = "username") @TableTitle(title = "濮撳悕", dataIndex = "username", key = "username") @ExcelProperty(index = 0) private String username; @@ -45,7 +43,6 @@ public class AddUpSituationDTO { // private String taxYearMonth; //涓◣鎵g即涔夊姟浜 - @SalaryTableColumn(text = "涓◣鎵g即涔夊姟浜", width = "10%", column = "taxAgentName") @TableTitle(title = "涓◣鎵g即涔夊姟浜", dataIndex = "taxAgentName", key = "taxAgentName") @ExcelProperty(index = 1) private String taxAgentName; @@ -56,162 +53,154 @@ public class AddUpSituationDTO { private Long taxAgentId; //閮ㄩ棬 - @SalaryTableColumn(text = "閮ㄩ棬", width = "10%", column = "departmentName") @TableTitle(title = "閮ㄩ棬", dataIndex = "departmentName", key = "departmentName") @ExcelProperty(index = 2) private String departmentName; //鎵嬫満鍙 - @SalaryTableColumn(text = "鎵嬫満鍙", width = "10%", column = "mobile") @TableTitle(title = "鎵嬫満鍙", dataIndex = "mobile", key = "mobile") @ExcelProperty(index = 3) private String mobile; //宸ュ彿 - @SalaryTableColumn(text = "宸ュ彿", width = "10%", column = "jobNum") @TableTitle(title = "宸ュ彿", dataIndex = "jobNum", key = "jobNum") @ExcelProperty(index = 4) private String jobNum; //璇佷欢鍙风爜 - @SalaryTableColumn(text = "璇佷欢鍙风爜", width = "10%", column = "idNo") @TableTitle(title = "璇佷欢鍙风爜", dataIndex = "idNo", key = "idNo") @ExcelProperty(index = 5) private String idNo; //鍏ヨ亴鏃ユ湡 - @SalaryTableColumn(text = "鍏ヨ亴鏃ユ湡", width = "10%", column = "hiredate") @TableTitle(title = "鍏ヨ亴鏃ユ湡", dataIndex = "hiredate", key = "hiredate") @ExcelProperty(index = 6) private String hiredate; //绱鏀跺叆棰 - @SalaryTableColumn(text = "绱鏀跺叆棰", width = "10%", column = "addUpIncome") @TableTitle(title = "绱鏀跺叆棰", dataIndex = "addUpIncome", key = "addUpIncome") @ExcelProperty(index = 7) @Encrypt private String addUpIncome; //绱鍑忛櫎璐圭敤 - @SalaryTableColumn(text = "绱鍑忛櫎璐圭敤", width = "10%", column = "addUpSubtraction") @TableTitle(title = "绱鍑忛櫎璐圭敤", dataIndex = "addUpSubtraction", key = "addUpSubtraction") @ExcelProperty(index = 8) @Encrypt private String addUpSubtraction; //绱绀句繚涓汉鍚堣 - @SalaryTableColumn(text = "绱绀句繚涓汉鍚堣", width = "10%", column = "addUpSocialSecurityTotal") @TableTitle(title = "绱绀句繚涓汉鍚堣", dataIndex = "addUpSocialSecurityTotal", key = "addUpSocialSecurityTotal") @ExcelProperty(index = 9) @Encrypt private String addUpSocialSecurityTotal; //绱鍏Н閲戜釜浜哄悎璁 - @SalaryTableColumn(text = "绱鍏Н閲戜釜浜哄悎璁", width = "10%", column = "addUpAccumulationFundTotal") @TableTitle(title = "绱鍏Н閲戜釜浜哄悎璁", dataIndex = "addUpAccumulationFundTotal", key = "addUpAccumulationFundTotal") @ExcelProperty(index = 10) @Encrypt private String addUpAccumulationFundTotal; //绱瀛愬コ鏁欒偛 - @SalaryTableColumn(text = "绱瀛愬コ鏁欒偛", width = "10%", column = "addUpChildEducation") - @TableTitle(title = "绱瀛愬コ鏁欒偛", dataIndex = "addUpChildEducation", key = "addUpChildEducation") - @ExcelProperty(index = 11) @Encrypt + @Deprecated private String addUpChildEducation; //绱缁х画鏁欒偛 - @SalaryTableColumn(text = "绱缁х画鏁欒偛", width = "10%", column = "addUpContinuingEducation") - @TableTitle(title = "绱缁х画鏁欒偛", dataIndex = "addUpContinuingEducation", key = "addUpContinuingEducation") - @ExcelProperty(index = 12) @Encrypt + @Deprecated private String addUpContinuingEducation; //绱浣忔埧璐锋鍒╂伅 - @SalaryTableColumn(text = "绱浣忔埧璐锋鍒╂伅", width = "10%", column = "addUpHousingLoanInterest") - @TableTitle(title = "绱浣忔埧璐锋鍒╂伅", dataIndex = "addUpHousingLoanInterest", key = "addUpHousingLoanInterest") - @ExcelProperty(index = 13) @Encrypt + @Deprecated private String addUpHousingLoanInterest; //绱浣忔埧绉熼噾 - @SalaryTableColumn(text = "绱浣忔埧绉熼噾", width = "10%", column = "addUpHousingRent") - @TableTitle(title = "绱浣忔埧绉熼噾", dataIndex = "addUpHousingRent", key = "addUpHousingRent") - @ExcelProperty(index = 14) @Encrypt + @Deprecated private String addUpHousingRent; //绱璧″吇鑰佷汉 - @SalaryTableColumn(text = "绱璧″吇鑰佷汉", width = "10%", column = "addUpSupportElderly") - @TableTitle(title = "绱璧″吇鑰佷汉", dataIndex = "addUpSupportElderly", key = "addUpSupportElderly") - @ExcelProperty(index = 15) @Encrypt + @Deprecated private String addUpSupportElderly; //绱澶х梾鍖荤枟 - @SalaryTableColumn(text = "绱澶х梾鍖荤枟", width = "10%", column = "addUpIllnessMedical") - @TableTitle(title = "绱澶х梾鍖荤枟", dataIndex = "addUpIllnessMedical", key = "addUpIllnessMedical") - @ExcelProperty(index = 16) @Encrypt + @Deprecated private String addUpIllnessMedical; //绱浼佷笟锛堣亴涓氾級骞撮噾鍙婂叾浠栫鍒 - @SalaryTableColumn(text = "绱浼佷笟锛堣亴涓氾級骞撮噾鍙婂叾浠栫鍒", width = "10%", column = "addUpEnterpriseAndOther") @TableTitle(title = "绱浼佷笟锛堣亴涓氾級骞撮噾鍙婂叾浠栫鍒", dataIndex = "addUpEnterpriseAndOther", key = "addUpEnterpriseAndOther") - @ExcelProperty(index = 17) + @ExcelProperty(index = 11) @Encrypt private String addUpEnterpriseAndOther; //绱鍏朵粬鎵i櫎 - @SalaryTableColumn(text = "绱鍏朵粬鎵i櫎", width = "10%", column = "addUpOtherDeduction") - @TableTitle(title = "绱鍏朵粬鎵i櫎", dataIndex = "addUpOtherDeduction", key = "addUpOtherDeduction") - @ExcelProperty(index = 18) + @TableTitle(title = "绱鍏朵粬鍏嶇◣鎵i櫎", dataIndex = "addUpOtherDeduction", key = "addUpOtherDeduction") + @ExcelProperty(index = 12) @Encrypt private String addUpOtherDeduction; //绱鍏嶇◣鏀跺叆 - @SalaryTableColumn(text = "绱鍏嶇◣鏀跺叆", width = "10%", column = "addUpTaxExemptIncome") @TableTitle(title = "绱鍏嶇◣鏀跺叆", dataIndex = "addUpTaxExemptIncome", key = "addUpTaxExemptIncome") - @ExcelProperty(index = 19) + @ExcelProperty(index = 13) @Encrypt private String addUpTaxExemptIncome; //绱鍑嗕簣鎵i櫎鐨勬崘璧犻 - @SalaryTableColumn(text = "绱鍑嗕簣鎵i櫎鐨勬崘璧犻", width = "10%", column = "addUpAllowedDonation") @TableTitle(title = "绱鍑嗕簣鎵i櫎鐨勬崘璧犻", dataIndex = "addUpAllowedDonation", key = "addUpAllowedDonation") - @ExcelProperty(index = 20) + @ExcelProperty(index = 14) @Encrypt private String addUpAllowedDonation; //绱鍑忓厤绋庨 - @SalaryTableColumn(text = "绱鍑忓厤绋庨", width = "10%", column = "addUpTaxSavings") @TableTitle(title = "绱鍑忓厤绋庨", dataIndex = "addUpTaxSavings", key = "addUpTaxSavings") - @ExcelProperty(index = 21) + @ExcelProperty(index = 15) @Encrypt private String addUpTaxSavings; //绱宸查鎵i缂寸◣棰 - @SalaryTableColumn(text = "绱宸查鎵i缂寸◣棰", width = "10%", column = "addUpAdvanceTax") @TableTitle(title = "绱宸查鎵i缂寸◣棰", dataIndex = "addUpAdvanceTax", key = "addUpAdvanceTax") - @ExcelProperty(index = 22) + @ExcelProperty(index = 16) @Encrypt private String addUpAdvanceTax; //绱濠村辜鍎跨収鎶 - @ExcelProperty(index = 23) - @SalaryTableColumn(text = "绱濠村辜鍎跨収鎶", width = "10%", column = "addUpInfantCare") - @TableTitle(title = "绱濠村辜鍎跨収鎶", dataIndex = "addUpInfantCare", key = "addUpInfantCare") @Encrypt + @Deprecated private String addUpInfantCare; //绱涓汉鍏昏侀噾 - @ExcelProperty(index = 24) - @SalaryTableColumn(text = "绱涓汉鍏昏侀噾", width = "10%", column = "addUpPrivatePension") - @TableTitle(title = "绱涓汉鍏昏侀噾", dataIndex = "addUpPrivatePension", key = "addUpPrivatePension") @Encrypt + @Deprecated private String addUpPrivatePension; - @SalaryTableColumn(text = "鎿嶄綔", width = "20%", column = "operate") + /** + * 瀹為檯绱宸查鎵i缂寸◣棰 + */ + @ExcelProperty(index = 17) + @TableTitle(title = "瀹為檯绱宸查鎵i缂寸◣棰", dataIndex = "actualAddUpAdvanceTax", key = "actualAddUpAdvanceTax") + @Encrypt + private String actualAddUpAdvanceTax; + + /** + * 涓◣璋冨樊 + */ + @ExcelProperty(index = 18) + @TableTitle(title = "涓◣璋冨樊", dataIndex = "taxAdjustment", key = "taxAdjustment") + @Encrypt + private String taxAdjustment; + + /** + * 绱搴旂撼绋庢墍寰楅 + */ + @ExcelProperty(index = 19) + @TableTitle(title = "绱搴旂撼绋庢墍寰楅", dataIndex = "addUpTaxableIncome", key = "addUpTaxableIncome") + @Encrypt + private String addUpTaxableIncome; + @TableTitle(title = "鎿嶄綔", dataIndex = "operate", key = "operate") private String operate; } \ No newline at end of file diff --git a/src/com/engine/salary/entity/datacollection/dto/AddUpSituationRecordDTO.java b/src/com/engine/salary/entity/datacollection/dto/AddUpSituationRecordDTO.java index e8c2fd0aa..dbd78ce3d 100644 --- a/src/com/engine/salary/entity/datacollection/dto/AddUpSituationRecordDTO.java +++ b/src/com/engine/salary/entity/datacollection/dto/AddUpSituationRecordDTO.java @@ -69,111 +69,128 @@ public class AddUpSituationRecordDTO { @ExcelProperty(index = 5) private String jobNum; - @SalaryTableColumn(text = "绱鏀跺叆棰", width = "10%", column = "addUpIncome") + //绱鏀跺叆棰 @TableTitle(title = "绱鏀跺叆棰", dataIndex = "addUpIncome", key = "addUpIncome") - @ExcelProperty(index = 6) + @ExcelProperty(index = 7) @Encrypt private String addUpIncome; - @SalaryTableColumn(text = "绱鍑忛櫎璐圭敤", width = "10%", column = "addUpSubtraction") + //绱鍑忛櫎璐圭敤 @TableTitle(title = "绱鍑忛櫎璐圭敤", dataIndex = "addUpSubtraction", key = "addUpSubtraction") - @ExcelProperty(index = 7) + @ExcelProperty(index = 8) @Encrypt private String addUpSubtraction; - @SalaryTableColumn(text = "绱绀句繚涓汉鍚堣", width = "10%", column = "addUpSocialSecurityTotal") + //绱绀句繚涓汉鍚堣 @TableTitle(title = "绱绀句繚涓汉鍚堣", dataIndex = "addUpSocialSecurityTotal", key = "addUpSocialSecurityTotal") - @ExcelProperty(index = 8) + @ExcelProperty(index = 9) @Encrypt private String addUpSocialSecurityTotal; - @SalaryTableColumn(text = "绱鍏Н閲戜釜浜哄悎璁", width = "10%", column = "addUpAccumulationFundTotal") + //绱鍏Н閲戜釜浜哄悎璁 @TableTitle(title = "绱鍏Н閲戜釜浜哄悎璁", dataIndex = "addUpAccumulationFundTotal", key = "addUpAccumulationFundTotal") - @ExcelProperty(index = 9) + @ExcelProperty(index = 10) @Encrypt private String addUpAccumulationFundTotal; - @ExcelProperty(index = 10) - @SalaryTableColumn(text = "绱瀛愬コ鏁欒偛", width = "10%", column = "addUpChildEducation") - @TableTitle(title = "绱瀛愬コ鏁欒偛", dataIndex = "addUpChildEducation", key = "addUpChildEducation") + //绱瀛愬コ鏁欒偛 @Encrypt + @Deprecated private String addUpChildEducation; - @ExcelProperty(index = 11) - @SalaryTableColumn(text = "绱缁х画鏁欒偛", width = "10%", column = "addUpContinuingEducation") - @TableTitle(title = "绱缁х画鏁欒偛", dataIndex = "addUpContinuingEducation", key = "addUpContinuingEducation") + //绱缁х画鏁欒偛 @Encrypt + @Deprecated private String addUpContinuingEducation; - @ExcelProperty(index = 12) - @SalaryTableColumn(text = "绱浣忔埧璐锋鍒╂伅", width = "10%", column = "addUpHousingLoanInterest") - @TableTitle(title = "绱浣忔埧璐锋鍒╂伅", dataIndex = "addUpHousingLoanInterest", key = "addUpHousingLoanInterest") + //绱浣忔埧璐锋鍒╂伅 @Encrypt + @Deprecated private String addUpHousingLoanInterest; - @ExcelProperty(index = 13) - @SalaryTableColumn(text = "绱浣忔埧绉熼噾", width = "10%", column = "addUpHousingRent") - @TableTitle(title = "绱浣忔埧绉熼噾", dataIndex = "addUpHousingRent", key = "addUpHousingRent") + //绱浣忔埧绉熼噾 @Encrypt + @Deprecated private String addUpHousingRent; - @ExcelProperty(index = 14) - @SalaryTableColumn(text = "绱璧″吇鑰佷汉", width = "10%", column = "addUpSupportElderly") - @TableTitle(title = "绱璧″吇鑰佷汉", dataIndex = "addUpSupportElderly", key = "addUpSupportElderly") + //绱璧″吇鑰佷汉 @Encrypt + @Deprecated private String addUpSupportElderly; - @ExcelProperty(index = 15) - @SalaryTableColumn(text = "绱澶х梾鍖荤枟", width = "10%", column = "addUpIllnessMedical") - @TableTitle(title = "绱澶х梾鍖荤枟", dataIndex = "addUpIllnessMedical", key = "addUpIllnessMedical") + //绱澶х梾鍖荤枟 @Encrypt + @Deprecated private String addUpIllnessMedical; - @ExcelProperty(index = 16) - @SalaryTableColumn(text = "绱浼佷笟锛堣亴涓氾級骞撮噾鍙婂叾浠栫鍒", width = "10%", column = "addUpEnterpriseAndOther") + //绱浼佷笟锛堣亴涓氾級骞撮噾鍙婂叾浠栫鍒 @TableTitle(title = "绱浼佷笟锛堣亴涓氾級骞撮噾鍙婂叾浠栫鍒", dataIndex = "addUpEnterpriseAndOther", key = "addUpEnterpriseAndOther") + @ExcelProperty(index = 11) @Encrypt private String addUpEnterpriseAndOther; - @ExcelProperty(index = 17) - @SalaryTableColumn(text = "绱鍏朵粬鎵i櫎", width = "10%", column = "addUpOtherDeduction") - @TableTitle(title = "绱鍏朵粬鎵i櫎", dataIndex = "addUpOtherDeduction", key = "addUpOtherDeduction") + //绱鍏朵粬鎵i櫎 + @TableTitle(title = "绱鍏朵粬鍏嶇◣鎵i櫎", dataIndex = "addUpOtherDeduction", key = "addUpOtherDeduction") + @ExcelProperty(index = 12) @Encrypt private String addUpOtherDeduction; - @ExcelProperty(index = 18) - @SalaryTableColumn(text = "绱鍏嶇◣鏀跺叆", width = "10%", column = "addUpTaxExemptIncome") + //绱鍏嶇◣鏀跺叆 @TableTitle(title = "绱鍏嶇◣鏀跺叆", dataIndex = "addUpTaxExemptIncome", key = "addUpTaxExemptIncome") + @ExcelProperty(index = 13) @Encrypt private String addUpTaxExemptIncome; - @ExcelProperty(index = 19) - @SalaryTableColumn(text = "绱鍑嗕簣鎵i櫎鐨勬崘璧犻", width = "10%", column = "addUpAllowedDonation") + //绱鍑嗕簣鎵i櫎鐨勬崘璧犻 @TableTitle(title = "绱鍑嗕簣鎵i櫎鐨勬崘璧犻", dataIndex = "addUpAllowedDonation", key = "addUpAllowedDonation") + @ExcelProperty(index = 14) @Encrypt private String addUpAllowedDonation; - @ExcelProperty(index = 20) - @SalaryTableColumn(text = "绱鍑忓厤绋庨", width = "10%", column = "addUpTaxSavings") + //绱鍑忓厤绋庨 @TableTitle(title = "绱鍑忓厤绋庨", dataIndex = "addUpTaxSavings", key = "addUpTaxSavings") + @ExcelProperty(index = 15) @Encrypt private String addUpTaxSavings; - @ExcelProperty(index = 21) - @SalaryTableColumn(text = "绱宸查鎵i缂寸◣棰", width = "10%", column = "addUpAdvanceTax") + //绱宸查鎵i缂寸◣棰 @TableTitle(title = "绱宸查鎵i缂寸◣棰", dataIndex = "addUpAdvanceTax", key = "addUpAdvanceTax") + @ExcelProperty(index = 16) @Encrypt private String addUpAdvanceTax; - @ExcelProperty(index = 22) - @SalaryTableColumn(text = "绱濠村辜鍎跨収鎶", width = "10%", column = "addUpInfantCare") - @TableTitle(title = "绱濠村辜鍎跨収鎶", dataIndex = "addUpInfantCare", key = "addUpInfantCare") + //绱濠村辜鍎跨収鎶 @Encrypt + @Deprecated private String addUpInfantCare; - @ExcelProperty(index = 23) - @SalaryTableColumn(text = "绱涓汉鍏昏侀噾", width = "10%", column = "addUpPrivatePension") - @TableTitle(title = "绱涓汉鍏昏侀噾", dataIndex = "addUpPrivatePension", key = "addUpPrivatePension") + //绱涓汉鍏昏侀噾 @Encrypt + @Deprecated private String addUpPrivatePension; + + /** + * 瀹為檯绱宸查鎵i缂寸◣棰 + */ + @ExcelProperty(index = 17) + @TableTitle(title = "瀹為檯绱宸查鎵i缂寸◣棰", dataIndex = "actualAddUpAdvanceTax", key = "actualAddUpAdvanceTax") + @Encrypt + private String actualAddUpAdvanceTax; + + /** + * 涓◣璋冨樊 + */ + @ExcelProperty(index = 18) + @TableTitle(title = "涓◣璋冨樊", dataIndex = "taxAdjustment", key = "taxAdjustment") + @Encrypt + private String taxAdjustment; + + /** + * 绱搴旂撼绋庢墍寰楅 + */ + @ExcelProperty(index = 19) + @TableTitle(title = "绱搴旂撼绋庢墍寰楅", dataIndex = "addUpTaxableIncome", key = "addUpTaxableIncome") + @Encrypt + private String addUpTaxableIncome; + } diff --git a/src/com/engine/salary/entity/datacollection/param/AddUpDeductionMonthTaxAgentParam.java b/src/com/engine/salary/entity/datacollection/param/AddUpDeductionMonthTaxAgentParam.java new file mode 100644 index 000000000..b22d0fd84 --- /dev/null +++ b/src/com/engine/salary/entity/datacollection/param/AddUpDeductionMonthTaxAgentParam.java @@ -0,0 +1,27 @@ +package com.engine.salary.entity.datacollection.param; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +/** + * 鏁版嵁閲囬泦-绱涓撻」闄勫姞鏈堜唤+鎵g即涓讳綋鍙傛暟 + * + * @author : chengliming + * @Date: 2022-09-29 10:38:25 + */ +@Data +@ApiModel("鏁版嵁閲囬泦-绱涓撻」闄勫姞鏈堜唤+鎵g即涓讳綋鍙傛暟") +public class AddUpDeductionMonthTaxAgentParam { + + @ApiModelProperty("绋庢鎵灞炴湡") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date declareMonth; + + @ApiModelProperty("涓◣鎵g即涔夊姟浜虹殑涓婚敭id") + private Long taxAgentId; + +} diff --git a/src/com/engine/salary/entity/datacollection/param/AddUpDeductionRequestFailQueryParam.java b/src/com/engine/salary/entity/datacollection/param/AddUpDeductionRequestFailQueryParam.java new file mode 100644 index 000000000..2be0f746d --- /dev/null +++ b/src/com/engine/salary/entity/datacollection/param/AddUpDeductionRequestFailQueryParam.java @@ -0,0 +1,25 @@ +package com.engine.salary.entity.datacollection.param; + +import com.engine.salary.common.BaseQueryParam; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + * 鏁版嵁閲囬泦-绱涓撻」闄勫姞鎵i櫎-鍦ㄧ嚎鑾峰彇澶辫触璁板綍鏌ヨ鍙傛暟 + * + * @author chengliming + * @date 2022-11-01 14:40:36 + */ +@EqualsAndHashCode(callSuper = true) +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("鏁版嵁閲囬泦-绱涓撻」闄勫姞鎵i櫎-鍦ㄧ嚎鑾峰彇澶辫触璁板綍鏌ヨ鍙傛暟") +public class AddUpDeductionRequestFailQueryParam extends BaseQueryParam { + + @ApiModelProperty("璇锋眰ID") + private Long requestId; + +} diff --git a/src/com/engine/salary/entity/datacollection/param/AddUpSituationParam.java b/src/com/engine/salary/entity/datacollection/param/AddUpSituationParam.java index d50184b2f..2fc47acd9 100644 --- a/src/com/engine/salary/entity/datacollection/param/AddUpSituationParam.java +++ b/src/com/engine/salary/entity/datacollection/param/AddUpSituationParam.java @@ -98,4 +98,13 @@ public class AddUpSituationParam { //绱涓汉鍏昏侀噾 private String addUpPrivatePension; + //瀹為檯绱宸查鎵i缂寸◣棰 + private String actualAddUpAdvanceTax; + + //涓◣璋冨樊 + private String taxAdjustment; + + //绱搴旂撼绋庢墍寰楅 + private String addUpTaxableIncome; + } diff --git a/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestFailPO.java b/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestFailPO.java new file mode 100644 index 000000000..a5baf15ca --- /dev/null +++ b/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestFailPO.java @@ -0,0 +1,76 @@ +package com.engine.salary.entity.datacollection.po; + +import com.engine.salary.report.enums.EmployeeTypeEnum; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Collection; +import java.util.Date; + +/** + * 鏁版嵁閲囬泦-绱涓撻」闄勫姞鎵i櫎鍦ㄧ嚎鏌ヨ澶辫触琛 + *

Copyright: Copyright (c) 2023

+ *

Company: 娉涘井杞欢

+ * + * @author qiantao + * @version 1.0 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +//hrsa_add_up_deduction_req_fail") +//鏁版嵁閲囬泦-绱涓撻」闄勫姞鎵i櫎鍦ㄧ嚎鏌ヨ澶辫触琛") +public class AddUpDeductionRequestFailPO implements Serializable { + + private static final long serialVersionUID = -4950145856639514995L; + + //ID") + private Long id; + + //鍒涘缓鏃堕棿", ignore = true) + private Date createTime; + + //淇敼鏃堕棿", ignore = true) + private Date updateTime; + + //鍒涘缓浜篿d", ignore = true) + private Long creator; + + //鏄惁鍒犻櫎", ignore = true) + private Integer deleteType; + + //绉熸埛KEY", ignore = true) + private String tenantKey; + + //鏌ヨ璇锋眰ID") + private Long requestId; + + //澶栭儴鏌ヨ璇锋眰ID") + private String outerRequestId; + + //鍛樺伐Id") + private Long employeeId; + + //涓◣鎵g即涔夊姟浜篒D") + private Long taxAgentId; + + //澶辫触鍘熷洜") + private String reason; + + //绋庢鎵灞炴湡") + private Date taxYearMonth; + + /** + * @see EmployeeTypeEnum + */ + //浜哄憳绫诲瀷") + private Integer employeeType; + + + private Collection ids; + +} diff --git a/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestPO.java b/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestPO.java new file mode 100644 index 000000000..6894a68ed --- /dev/null +++ b/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestPO.java @@ -0,0 +1,75 @@ +package com.engine.salary.entity.datacollection.po; + +import com.engine.salary.enums.datacollection.EnumAddUpDeductionRequestStatus; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Collection; +import java.util.Date; + +/** + * 鏁版嵁閲囬泦-绱涓撻」闄勫姞鎵i櫎鍦ㄧ嚎鏌ヨ琛 + * + * @author chengliming + * @date: 2022-10-26 16:07:04 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +//hrsa_add_up_deduction_request +//鏁版嵁閲囬泦-绱涓撻」闄勫姞鎵i櫎鍦ㄧ嚎鏌ヨ琛 +public class AddUpDeductionRequestPO implements Serializable { + + private static final long serialVersionUID = 1452863635879051515L; + + //ID + private Long id; + + //鍒涘缓鏃堕棿" + private Date createTime; + + //淇敼鏃堕棿" + private Date updateTime; + + //鍒涘缓浜篿d" + private Long creator; + + //鏄惁鍒犻櫎" + private Integer deleteType; + + //绉熸埛KEY" + private String tenantKey; + + //涔愯閿佺増鏈" + private Integer lockVersion; + + //鏌ヨ璇锋眰ID + private Long requestId; + + //澶栭儴鎺ュ彛鏌ヨ璇锋眰ID + private String outerRequestId; + + /** + * @see EnumAddUpDeductionRequestStatus + */ + //璇锋眰澶勭悊鐘舵 + private Integer requestStatus; + + //绋庢鎵灞炴湡 + private Date taxYearMonth; + + //涓◣鎵g即涔夊姟浜篒D + private Long taxAgentId; + + + + private Collection ids; + private Collection requestStatuss; + private Integer oldStatus; + private Integer oldLockVersion; + +} diff --git a/src/com/engine/salary/entity/datacollection/po/DataCollectionBaseInfo.java b/src/com/engine/salary/entity/datacollection/po/DataCollectionBaseInfo.java new file mode 100644 index 000000000..c9ab8ac5a --- /dev/null +++ b/src/com/engine/salary/entity/datacollection/po/DataCollectionBaseInfo.java @@ -0,0 +1,51 @@ +package com.engine.salary.entity.datacollection.po; + +import java.time.LocalDateTime; + +/** + * 鏁版嵁閲囬泦-鎶借薄鎺ュ彛-鏂逛究浣跨敤娉涘瀷灏佽鏂规硶(po缁ф壙绫讳細瀵艰嚧鍔犲瘑aop鎶ラ敊锛屽師鍥犱笉鐭ワ紝鎵浠ヨ繖閲屼娇鐢ㄦ帴鍙f娊璞) + * + * @author chengliming + * @date: 2022-09-30 10:55:40 + */ +public interface DataCollectionBaseInfo { + + /** + * 鑾峰彇id + * + * @return + */ + Long getId(); + + Long getModifier(); + + Long getEmployeeId(); + + Long getTaxAgentId(); + + Integer getDeleteType(); + + String getTenantKey(); + + LocalDateTime getCreateTime(); + + LocalDateTime getUpdateTime(); + + void setId(Long id); + + void setModifier(Long modifier); + + void setEmployeeId(Long employeeId); + + void setTaxAgentId(Long taxAgentId); + + void setDeleteType(Integer deleteType); + + void setTenantKey(String tenantKey); + + void setCreateTime(LocalDateTime createTime); + + void setUpdateTime(LocalDateTime updateTime); + + void setCreator(Long creator); +} diff --git a/src/com/engine/salary/entity/datacollection/po/SpecialAddDeductionPO.java b/src/com/engine/salary/entity/datacollection/po/SpecialAddDeductionPO.java index 9aaaa7363..01c11be8e 100644 --- a/src/com/engine/salary/entity/datacollection/po/SpecialAddDeductionPO.java +++ b/src/com/engine/salary/entity/datacollection/po/SpecialAddDeductionPO.java @@ -17,6 +17,7 @@ import java.util.Date; @AllArgsConstructor @NoArgsConstructor @Accessors(chain = true) +//hrsa_special_add_deduction public class SpecialAddDeductionPO { private Long id; diff --git a/src/com/engine/salary/entity/datacollection/response/GetCompanyIncomesResponse.java b/src/com/engine/salary/entity/datacollection/response/GetCompanyIncomesResponse.java new file mode 100644 index 000000000..0e71b0da8 --- /dev/null +++ b/src/com/engine/salary/entity/datacollection/response/GetCompanyIncomesResponse.java @@ -0,0 +1,395 @@ +package com.engine.salary.entity.datacollection.response; + +import com.engine.salary.entity.taxpayment.response.BaseResponse; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + +/** + * 浜哄憳涓撻」闄勫姞鎵i櫎淇℃伅鏌ヨ缁撴灉 + * + * @author chengliming + * @date 2022-10-27 10:00 AM + **/ +@Data +@EqualsAndHashCode(callSuper = true) +public class GetCompanyIncomesResponse extends BaseResponse { + + /** + * 杩斿洖鏁版嵁 + */ + private Body body; + + /** + * 浜哄憳涓撻」闄勫姞鎵i櫎淇℃伅鏌ヨ缁撴灉body + **/ + @Data + public static class Body { + /** + * 鏄庣粏 + */ + private List sfmx; + + /** + * 鍚堣 + */ + private Sum sfhj; + } + + @Data + public static class Detail { + /** + * 鏄惁鏄庣粏鐢虫姤 + **/ + private String sfmxsb; + /** + * 绾崇◣浜哄鍚 + **/ + private String xm; + /** + * 绾崇◣璇嗗埆鍙 + **/ + private String nsrsbh; + /** + * 璇佷欢绫诲瀷 + **/ + private String zjlx; + /** + * 璇佷欢鍙风爜 + **/ + private String zjhm; + /** + * 闈炲眳姘戜釜浜 + **/ + private String sffjm; + /** + * 鎵寰楅」鐩悕绉 + **/ + private String sdxmmc; + /** + * 鏀跺叆棰 + **/ + private String sre; + /** + * 璐圭敤 + **/ + private String fy; + /** + * 鍏嶇◣鏀跺叆 + **/ + private String mssr; + /** + * 璐骇鍘熷 + **/ + private String ccyz; + /** + * 鎶曡祫鎶垫墸 + **/ + private String tzdk; + /** + * 鍏佽鎵i櫎鐨勮垂鐢 + **/ + private String yxkcsf; + /** + * 鍑忚姣斾緥 + **/ + private String jjbl; + /** + * 鍑忛櫎璐圭敤 + **/ + private String jcfy; + /** + * 鍩烘湰鍏昏佷繚闄 + **/ + private String jbylaobxf; + /** + * 鍩烘湰鍖荤枟淇濋櫓璐 + **/ + private String jbylbxf; + /** + * 澶变笟淇濋櫓璐 + **/ + private String sybxf; + /** + * 浣忔埧鍏Н閲 + **/ + private String zfgjj; + /** + * 骞撮噾 + **/ + private String nj; + /** + * 鍟嗕笟鍋ュ悍淇濋櫓 + **/ + private String syjkbx; + /** + * 绋庡欢鍏昏佷繚闄 + **/ + private String syylbx; + /** + * 鍏跺畠鎵i櫎 + **/ + private String qt; + /** + * 鍑嗕簣鎵i櫎鐨勬崘璧犻 + **/ + private String zykcjze; + /** + * 绱鏀跺叆棰 + **/ + private String ljsre; + /** + * 绱鍑忛櫎璐圭敤 + **/ + private String ljjcfy; + /** + * 绱涓撻」鎵i櫎 + **/ + private String ljzxkc; + /** + * 绱瀛愬コ鏁欒偛 + **/ + private String ljznjy; + /** + * 绱璧″吇鑰佷汉 + **/ + private String ljsylr; + /** + * 绱浣忔埧璐锋鍒╂伅 + **/ + private String ljzfdklx; + /** + * 绱浣忔埧绉熼噾 + **/ + private String ljzfzj; + /** + * 绱缁х画鏁欒偛 + **/ + private String ljjxjy; + /** + * 绱3宀佷互涓嬪┐骞煎効鐓ф姢鏀嚭 + **/ + private String ljyyezhzc; + /** + * 绱鍏跺畠鎵i櫎 + **/ + private String ljqtkc; + /** + * 绱鍑嗕簣鎵i櫎鐨勬崘璧犻 + **/ + private String ljzykcjze; + /** + * 绱涓汉鍏昏侀噾 + **/ + private String ljgrylj; + /** + * 搴旂撼绋庢墍寰楅 + **/ + private String ynssde; + /** + * 绋庣巼 + **/ + private String sl; + /** + * 鍗忓畾绋庣巼 + **/ + private String xdsl; + /** + * 閫熺畻鎵i櫎鏁 + **/ + private String sskcs; + /** + * 搴旂撼绋庨 + **/ + private String ynse; + /** + * 鍑忓厤绋庨 + **/ + private String jmse; + /** + * 宸叉墸缂寸◣棰 + **/ + private String ykjse; + /** + * 搴旇ˉ閫绋庨 + **/ + private String ybtse; + /** + * 澶囨敞 + **/ + private String bz; + /** + * 鍒嗘憡骞村害鏁 + **/ + private String ftnds; + /** + * 骞村噺闄よ垂鐢 + **/ + private String njcfy; + /** + * 搴旀墸缂寸◣棰 + **/ + private String kjse; + /** + * 璇佸埜璐︽埛鍙 + **/ + private String zqzhh; + /** + * 鑲$エ浠g爜 + **/ + private String gpdm; + /** + * 鑲$エ鍚嶇О + **/ + private String gpmc; + /** + * 姣忚偂璁$◣浠锋牸 + **/ + private String mgjsjg; + /** + * 杞鑲℃暟 + **/ + private String zrgs; + /** + * 闄愬敭鑲″師鍊 + **/ + private String xsgyz; + /** + * 鍚堢悊绋庤垂 + **/ + private String hlsf; + /** + * 鎵i櫎鍙婂噺闄ら」鐩悎璁 + **/ + private String kcjjcxmhj; + } + + /** + * 鍚堣 + */ + @Data + public static class Sum { + /** + * 鏀跺叆棰濆悎璁 + */ + private String srehj; + /** + * 鍏嶇◣鏀跺叆鍚堣 + */ + private String mssrhj; + /** + * 璐骇鍘熷煎悎璁 + */ + private String ccyzhj; + /** + * 鎶曡祫鎶垫墸鍚堣 + */ + private String tzdkhj; + /** + * 鍏佽鎵i櫎鐨勭◣璐瑰悎璁 + */ + private String yxkcsfhj; + /** + * 鍩烘湰鍏昏佷繚闄╄垂鍚堣 + */ + private String jbylaobxfhj; + /** + * 鍩烘湰鍖荤枟淇濋櫓璐瑰悎璁 + */ + private String jbylbxfhj; + /** + * 澶变笟淇濋櫓璐瑰悎璁 + */ + private String sybxfhj; + /** + * 浣忔埧鍏Н閲戝悎璁 + */ + private String zfgjjhj; + /** + * 骞撮噾鍚堣 + */ + private String njhj; + /** + * 鍟嗕笟鍋ュ悍淇濋櫓鍚堣 + */ + private String syjkbxhj; + /** + * 绋庡欢鍏昏佷繚闄╁悎璁 + */ + private String syylbxhj; + /** + * 鍏朵粬鎵i櫎鍚堣 + */ + private String qthj; + /** + * 鍑嗕簣鎵i櫎鐨勬崘璧犻鍚堣 + */ + private String zykcjzehj; + /** + * 绱鏀跺叆棰濆悎璁 + */ + private String ljsrehj; + /** + * 绱涓撻」鎵i櫎鍚堣 + */ + private String ljzxkchj; + /** + * 绱瀛愬コ鏁欒偛鍚堣 + */ + private String ljznjyhj; + /** + * 绱璧″吇鑰佷汉鍚堣 + */ + private String ljsylrhj; + /** + * 绱浣忔埧璐锋鍒╂伅鍚堣 + */ + private String ljzfdklxhj; + /** + * 绱浣忔埧绉熼噾鍚堣 + */ + private String ljzfzjhj; + /** + * 绱缁х画鏁欒偛鍚堣 + */ + private String ljjxjyhj; + /** + * 绱3宀佷互涓嬪┐骞煎効鐓ф姢鏀嚭鍚堣 + */ + private String ljyyezhzchj; + /** + * 绱鍏朵粬鎵i櫎鍚堣 + */ + private String ljqtkchj; + /** + * 绱鍑嗕簣鎵i櫎鐨勬崘璧犻鍚堣 + */ + private String ljzykcjzehj; + /** + * 绱涓汉鍏昏侀噾鍚堣 + */ + private String ljgryljhj; + /** + * 搴旂撼绋庢墍寰楅鍚堣 + */ + private String ynssdehj; + /** + * 搴旂撼绋庨鍚堣 + */ + private String ynsehj; + /** + * 鍑忓厤绋庨鍚堣 + */ + private String jmsehj; + /** + * 宸叉墸缂寸◣棰濆悎璁 + */ + private String ykjsehj; + /** + * 搴旇ˉ閫绋庨鍚堣 + */ + private String ybtsehj; + } + +} diff --git a/src/com/engine/salary/entity/datacollection/response/QuerySpecialAmountResponse.java b/src/com/engine/salary/entity/datacollection/response/QuerySpecialAmountResponse.java index 4562612e1..fc5503724 100644 --- a/src/com/engine/salary/entity/datacollection/response/QuerySpecialAmountResponse.java +++ b/src/com/engine/salary/entity/datacollection/response/QuerySpecialAmountResponse.java @@ -2,28 +2,28 @@ package com.engine.salary.entity.datacollection.response; import com.engine.salary.entity.taxpayment.response.BaseResponse; import lombok.Data; +import lombok.EqualsAndHashCode; /** * 浜哄憳涓撻」闄勫姞鎵i櫎淇℃伅鏌ヨ缁撴灉 - *

Copyright: Copyright (c) 2023

- *

Company: 娉涘井杞欢

* * @author qiantao * @version 1.0 **/ @Data +@EqualsAndHashCode(callSuper = true) public class QuerySpecialAmountResponse extends BaseResponse { /** * 杩斿洖鏁版嵁 */ - private QuerySpecialAmountBody body; + private Body body; /** * 浜哄憳涓撻」闄勫姞鎵i櫎淇℃伅鏌ヨ缁撴灉body **/ @Data - public static class QuerySpecialAmountBody { + public static class Body { /** * 璇锋眰鏌ヨID */ diff --git a/src/com/engine/salary/entity/employeedeclare/po/EmployeeDeclarePO.java b/src/com/engine/salary/entity/employeedeclare/po/EmployeeDeclarePO.java index a8c23d03b..b589d29c5 100644 --- a/src/com/engine/salary/entity/employeedeclare/po/EmployeeDeclarePO.java +++ b/src/com/engine/salary/entity/employeedeclare/po/EmployeeDeclarePO.java @@ -219,4 +219,5 @@ public class EmployeeDeclarePO { private Collection ids; private Collection employeeIds; + private Collection taxAgentIds; } diff --git a/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctCalculateBO.java b/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctCalculateBO.java index 22af2b674..f29ccd1ce 100644 --- a/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctCalculateBO.java +++ b/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctCalculateBO.java @@ -68,7 +68,7 @@ public class SalaryAcctCalculateBO { /** * 鏈杩愮畻鐨勮柂璧勯」鐩紙宸叉帓濂借繍绠椾紭鍏堢骇锛 */ - private List> salaryItemIdWithPriorityList; + private List salaryItemIdWithPriorityList; /** * 鏈杩愮畻娑夊強鐨勬墍鏈夊叕寮 diff --git a/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctCalculatePriorityBO.java b/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctCalculatePriorityBO.java index 197ad1245..bc5ee6d93 100644 --- a/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctCalculatePriorityBO.java +++ b/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctCalculatePriorityBO.java @@ -1,6 +1,5 @@ package com.engine.salary.entity.salaryacct.bo; -import com.engine.salary.constant.SalaryFormulaFieldConstant; import com.engine.salary.entity.salaryformula.ExpressFormula; import com.engine.salary.entity.salaryformula.po.FormulaVar; import com.engine.salary.entity.salaryitem.po.SalaryItemPO; @@ -21,9 +20,10 @@ import org.apache.commons.lang3.StringUtils; import java.util.*; import java.util.regex.Matcher; -import java.util.regex.Pattern; import java.util.stream.Collectors; +import static com.engine.salary.constant.SalaryFormulaFieldConstant.SALARY_PATTERN; + /** * 钖祫鏍哥畻-钖祫椤圭洰杩愮畻浼樺厛绾 *

Copyright: Copyright (c) 2022

@@ -34,16 +34,6 @@ import java.util.stream.Collectors; **/ public class SalaryAcctCalculatePriorityBO { - /** - * 鍏紡涓彉閲忕殑fieldId鐨勬鍒欒〃杈惧紡 - */ - private static final String SALARY_REGEX = "(\\w+)" + SalaryFormulaFieldConstant.FIELD_ID_SEPARATOR + "(\\w+)"; - - /** - * 瑙f瀽鍏紡涓彉閲忕殑fieldId鐨勬鍒欒〃杈惧紡 - */ - private static final Pattern SALARY_PATTERN = Pattern.compile(SALARY_REGEX); - /** * 璁$畻浼樺厛绾 * diff --git a/src/com/engine/salary/entity/salaryacct/bo/SalaryCalcItem.java b/src/com/engine/salary/entity/salaryacct/bo/SalaryCalcItem.java new file mode 100644 index 000000000..42df567df --- /dev/null +++ b/src/com/engine/salary/entity/salaryacct/bo/SalaryCalcItem.java @@ -0,0 +1,59 @@ +package com.engine.salary.entity.salaryacct.bo; + +import com.engine.salary.entity.salaryformula.ExpressFormula; +import com.engine.salary.enums.SalaryRoundingModeEnum; +import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 钖祫鏍哥畻娑夊強鐨勮柂璧勯」鐩 + *

Copyright: Copyright (c) 2023

+ *

Company: 娉涘井杞欢

+ * + * @author qiantao + * @version 1.0 + **/ +@Data +@Accessors(chain = true) +public class SalaryCalcItem { + + /** + * 钖祫椤圭洰id + */ + private Long salaryItemId; + /** + * 钖祫椤圭洰缂栧彿 + */ + private String salaryItemCode; + /** + * 鎵寰楅」鐩 + */ + private String incomeCategory; + /** + * 钖祫妗f寮曠敤銆0锛氳柂璧勬。妗堟湭寮曠敤銆1锛氳柂璧勬。妗堝紩鐢 + * 涓哄鐞嗗巻鍙叉暟鎹岀暀锛屼笉鍐嶄娇鐢 + */ + @Deprecated + private Integer useInEmployeeSalary; + /** + * 瀛楁绫诲瀷 + * @see SalaryDataTypeEnum + */ + private String dataType; + /** + * 鑸嶅叆瑙勫垯 + * @see SalaryRoundingModeEnum + */ + private Integer roundingMode; + /** + * 灏忔暟浣嶆暟 + */ + private Integer pattern; + /** + * 鍏紡 + */ + private ExpressFormula expressFormula; + + +} diff --git a/src/com/engine/salary/entity/salaryacct/bo/SalaryCalcItemGraph.java b/src/com/engine/salary/entity/salaryacct/bo/SalaryCalcItemGraph.java new file mode 100644 index 000000000..52baba1db --- /dev/null +++ b/src/com/engine/salary/entity/salaryacct/bo/SalaryCalcItemGraph.java @@ -0,0 +1,176 @@ +package com.engine.salary.entity.salaryacct.bo; + +import com.engine.salary.entity.salaryformula.ExpressFormula; +import com.engine.salary.entity.salaryformula.po.FormulaVar; +import com.engine.salary.entity.salaryitem.po.SalaryItemPO; +import com.engine.salary.entity.salarysob.po.SalarySobItemPO; +import com.engine.salary.enums.salaryformula.SalaryFormulaReferenceEnum; +import com.engine.salary.report.common.constant.SalaryConstant; +import com.engine.salary.util.SalaryEntityUtil; +import com.google.common.collect.Lists; +import lombok.Data; +import org.apache.commons.lang3.StringUtils; + +import java.util.*; +import java.util.concurrent.LinkedTransferQueue; + +/** + * 瀵硅柂璧勬牳绠楁椂娑夊強鐨勮柂璧勯」鐩繘琛屾帓搴 + *

Copyright: Copyright (c) 2023

+ *

Company: 娉涘井杞欢

+ * + * @author qiantao + * @version 1.0 + **/ +public class SalaryCalcItemGraph { + + private List nodes; + + /** + * 鏍规嵁钖祫璐﹀鐨勮柂璧勯」鐩佸叕寮忚鎯呮瀯寤哄疄渚 + * + * @param salarySobItems 钖祫璐﹀鐨勮柂璧勯」鐩 + * @param expressFormulas 鍏紡璇︽儏 + */ + public SalaryCalcItemGraph(List salarySobItems, List salaryItemPOS, List expressFormulas) { + Map salarySobItemMap = SalaryEntityUtil.convert2Map(salarySobItems, SalarySobItemPO::getSalaryItemCode); + Map salaryItemMap = SalaryEntityUtil.convert2Map(salaryItemPOS, SalaryItemPO::getCode); + Map expressFormulaMap = SalaryEntityUtil.convert2Map(expressFormulas, ExpressFormula::getId); + Map> formulaVarMap = ExpressFormulaBO.buildFormulaVar(expressFormulas); + + Map nodeMap = new HashMap<>(); + for (SalarySobItemPO salarySobItem : salarySobItems) { + ExpressFormula expressFormula = expressFormulaMap.get(salarySobItem.getFormulaId()); + SalaryCalcItemGraphNode node = nodeMap.computeIfAbsent(salarySobItem.getSalaryItemId(), key -> new SalaryCalcItemGraphNode(salarySobItem, expressFormula)); + List formulaVars = expressFormula == null ? Collections.emptyList() : formulaVarMap.getOrDefault(expressFormula.getId(), Collections.emptyList()); + for (FormulaVar formulaVar : formulaVars) { + if (StringUtils.isNotEmpty(formulaVar.getFieldId()) && StringUtils.startsWith(formulaVar.getFieldId(), SalaryFormulaReferenceEnum.SALARY_ITEM.getValue() + SalaryConstant.FORMULA_VAR_SEPARATOR)) { + String salaryItemCode = formulaVar.getFieldId().split(SalaryConstant.FORMULA_VAR_SEPARATOR)[1]; + SalarySobItemPO subSalarySobItem = salarySobItemMap.get(salaryItemCode); + if (subSalarySobItem == null) { + SalaryItemPO salaryItemPO = salaryItemMap.get(salaryItemCode); + if (salaryItemPO == null) { + continue; + }else { + subSalarySobItem = SalarySobItemPO.builder().salaryItemId(salaryItemPO.getId()).salaryItemCode(salaryItemPO.getCode()).build(); + } + } + ExpressFormula subExpressFormula = expressFormulaMap.get(subSalarySobItem.getFormulaId()); + SalarySobItemPO finalSubSalarySobItem = subSalarySobItem; + SalaryCalcItemGraphNode destNode = nodeMap.computeIfAbsent(subSalarySobItem.getSalaryItemId(), key -> new SalaryCalcItemGraphNode(finalSubSalarySobItem, subExpressFormula)); + node.getDestNodes().add(destNode); + } + } + } + this.nodes = Lists.newArrayList(nodeMap.values()); + } + + /** + * 瀵硅柂璧勬牳绠楁椂娑夊強鐨勮柂璧勯」鐩繘琛屾帓搴 + * 瀵逛簬涓娆¤柂璧勬牳绠楄岃█锛屼笉鍚岀殑钖祫椤圭洰涔嬮棿鍙兘浼氬瓨鍦ㄥ紩鐢ㄣ + * 渚嬪銆岀哗鏁堝伐璧=缁╂晥姣斾緥*(鍩烘湰宸ヨ祫+宀椾綅宸ヨ祫)銆嶏紝鍦ㄨ绠椼岀哗鏁堝伐璧勩嶅墠闇瑕佸厛璁$畻鍑恒岀哗鏁堟瘮渚嬨嶃併屽熀鏈伐璧勩嶃併屽矖浣嶅伐璧勩 + * 鎵浠ヨ柂璧勬牳绠楀墠闇瑕佸鎵娑夊強鐨勬墍鏈夎柂璧勯」鐩繘琛屼竴涓绠楁帓搴 + * 瀵硅柂璧勯」鐩殑鎺掑簭灏辩浉褰撲簬鏄涓涓屾湁鍚戞棤鐜殑鍥俱嶈繘琛屾嫇鎵戞帓搴忥紝涓涓柂璧勯」鐩氨鐩稿綋浜庡浘涓殑涓涓岄《鐐广 + * 鍏蜂綋绠楁硶濡備笅锛 + * 1銆佹牴鎹岃柂璧勮处濂楃殑钖祫椤圭洰銆嶃併屽叕寮忚鎯呫嶆瀯寤哄嚭鎵鏈夌殑銆岄《鐐广 + * 2銆佸皢鎵鏈夐《鐐圭殑鍏ュ害閮藉垵濮嬪寲涓0 + * 3銆侀亶鍘嗘墍鏈夌殑椤剁偣锛岃绠楁瘡涓《鐐圭殑鍏ュ害 + * 4銆佸垱寤轰竴涓槦鍒楋紝灏嗘墍鏈夊叆搴︿负0鐨勯《鐐归兘瀛樺叆闃熷垪 + * 5銆佹瘡娆′粠闃熷垪涓彇鍑轰竴涓偣锛屽皢璇ョ偣瀛樺叆缁撴灉闆嗗悎涓紝骞跺皢璇ラ《鐐圭殑鎵鏈夐偦鎺ョ偣鐨勫叆搴﹀噺1銆傚鏋滈偦鎺ョ偣鐨勫叆搴﹀彉涓轰簡0锛屽皢鍏跺姞鍏ラ槦鍒椾腑 + * 6銆侀噸澶嶆楠5锛岀洿鍒伴槦鍒楃┖浜 + * + * @return 鎺掑ソ搴忕殑钖祫椤圭洰id + */ + public List sort() { + // 寰幆閬嶅巻鎵鏈夐《鐐 + for (SalaryCalcItemGraphNode node : nodes) { + // 寰幆閬嶅巻姣忎釜椤剁偣鐨勯偦灞 + for (SalaryCalcItemGraphNode destNode : node.getDestNodes()) { + // 缁存姢姣忎釜椤剁偣鐨勫叆搴 + destNode.setInDegree(destNode.getInDegree() + 1); + } + } + + // 鍒涘缓涓涓槦鍒 + LinkedTransferQueue queue = new LinkedTransferQueue<>(); + + // 鍐嶆寰幆鎵鏈夐《鐐 + for (SalaryCalcItemGraphNode node : nodes) { + // 鑻ヨ椤剁偣鍏ュ害涓0锛屽垯鍔犲叆闃熷垪 + if (node.getInDegree() == 0) { + queue.offer(node); + } + } + + // 瀛樺偍缁撴灉鐨勫垪琛 + List result = new ArrayList<>(); + // 寰幆鐩村埌闃熷垪涓虹┖ + while (!queue.isEmpty()) { + // 鍙栧嚭闃熷垪澶撮儴鐨勯《鐐圭紪鍙 + SalaryCalcItemGraphNode node = queue.poll(); + // 灏嗚椤剁偣鍔犲叆鍒扮粨鏋滃垪琛ㄤ腑 + result.add(node.getSalaryCalcItem()); + // 鏍囪璇ラ《鐐瑰凡琚闂 + node.setVisited(true); + + // 閬嶅巻璇ラ《鐐圭殑閭诲眳 + for (SalaryCalcItemGraphNode destNode : node.getDestNodes()) { + // 鑻ヨ閭诲眳鏈璁块棶杩 + if (!destNode.isVisited()) { + // 灏嗚閭诲眳鐨勫叆搴﹀噺涓 + destNode.setInDegree(destNode.getInDegree() - 1); + // 鑻ヨ閭诲眳鍏ュ害宸茬粡鍙樹负0 + if (destNode.getInDegree() == 0) { + // 灏嗚閭诲眳鍔犲叆鍒伴槦鍒椾腑 + queue.offer(destNode); + } + } + } + } + + // 鍊掑簭 + Collections.reverse(result); + // 杩斿洖缁撴灉鍒楄〃 + return result; + } + + @Data + private static class SalaryCalcItemGraphNode { + + /** + * 钖祫椤圭洰鐨刬d + */ + private SalaryCalcItem salaryCalcItem; + + /** + * 鍏ュ害 + */ + private int inDegree; + + /** + * 鏄惁宸茶璁块棶 + */ + private boolean visited; + + /** + * 褰撳墠椤剁偣鐨勯偦灞 + */ + private List destNodes; + + public SalaryCalcItemGraphNode(SalarySobItemPO salarySobItem, ExpressFormula expressFormula) { + SalaryCalcItem salaryCalcItem = new SalaryCalcItem(); + salaryCalcItem.setSalaryItemId(salarySobItem.getSalaryItemId()); + salaryCalcItem.setSalaryItemCode(salarySobItem.getSalaryItemCode()); + salaryCalcItem.setIncomeCategory(salarySobItem.getIncomeCategory()); +// salaryCalcItem.setUseInEmployeeSalary(salarySobItem.getUseInEmployeeSalary()); +// salaryCalcItem.setDataType(salarySobItem.getDataType()); + salaryCalcItem.setRoundingMode(salarySobItem.getRoundingMode()); + salaryCalcItem.setPattern(salarySobItem.getPattern()); + salaryCalcItem.setExpressFormula(expressFormula); + this.salaryCalcItem = salaryCalcItem; + this.inDegree = 0; + this.visited = false; + this.destNodes = new ArrayList<>(); + } + } +} diff --git a/src/com/engine/salary/entity/salaryacct/po/SalaryAcctTaxAgentPO.java b/src/com/engine/salary/entity/salaryacct/po/SalaryAcctTaxAgentPO.java index 4a7dd7da6..d12a5a5ac 100644 --- a/src/com/engine/salary/entity/salaryacct/po/SalaryAcctTaxAgentPO.java +++ b/src/com/engine/salary/entity/salaryacct/po/SalaryAcctTaxAgentPO.java @@ -1,9 +1,11 @@ package com.engine.salary.entity.salaryacct.po; +import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; +import lombok.NoArgsConstructor; import lombok.experimental.Accessors; -import java.time.LocalDateTime; import java.util.Date; /** @@ -15,7 +17,10 @@ import java.util.Date; * @version 1.0 **/ @Data +@Builder @Accessors(chain = true) +@NoArgsConstructor +@AllArgsConstructor // "hrsa_acct_tax_agent") public class SalaryAcctTaxAgentPO { @@ -67,10 +72,15 @@ public class SalaryAcctTaxAgentPO { /** * 鍒涘缓鏃堕棿 */ - private LocalDateTime createTime; + private Date createTime; /** * 鏇存柊鏃堕棿 */ - private LocalDateTime updateTime; + private Date updateTime; + + + + private Date startMonth; + private Date endMonth; } diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentTaxReturnPO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentTaxReturnPO.java index b338e53b6..717a5e960 100644 --- a/src/com/engine/salary/entity/taxagent/po/TaxAgentTaxReturnPO.java +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentTaxReturnPO.java @@ -145,6 +145,7 @@ public class TaxAgentTaxReturnPO implements Serializable { //鏌ヨ鏉′欢 + private Collection ids; private Collection taxAgentIds; private Collection taxCodes; } diff --git a/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclarationCommon.java b/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclarationCommon.java index 6fc30bf15..5a4f908e3 100644 --- a/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclarationCommon.java +++ b/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclarationCommon.java @@ -160,7 +160,7 @@ public class TaxDeclarationCommon implements TaxDeclarationStrategy { .addUpTaxExemptIncome(valueMap.get("addUpTaxExemptIncome")) .addUpAllowedDonation(valueMap.get("addUpAllowedDonation")) .addUpAdvanceTax(valueMap.get("addUpAdvanceTax")) -// .addUpTaxableIncome(valueMap.get("addUpTaxableIncome")) + .addUpTaxableIncome(valueMap.get("addUpTaxableIncome")) // .modifier(taxDeclaration.getCreator()) .creator(taxDeclaration.getCreator()) .createTime(taxDeclaration.getCreateTime()) diff --git a/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclarationValueList.java b/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclarationValueList.java index 8b78d34d8..ee755aad5 100644 --- a/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclarationValueList.java +++ b/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclarationValueList.java @@ -94,7 +94,7 @@ public class TaxDeclarationValueList { dataMap.put("username", employeeDeclare.getEmployeeName()); dataMap.put("cardType", SalaryI18nUtil.getI18nLabel(CardTypeEnum.RESIDENT_IDENTITY_CARDS.getLabelId(), CardTypeEnum.RESIDENT_IDENTITY_CARDS.getDefaultLabel())); dataMap.put("cardNum", employeeDeclare.getCardNum()); - } else if (Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue())) { + } else if (taxDeclarationValue.getEmployeeType() == null || Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue())) { DataCollectionEmployee simpleEmployee = simpleEmployeeMap.get(taxDeclarationValue.getEmployeeId()); DataCollectionEmployee simpleUserInfo = simpleUserInfoMap.get(taxDeclarationValue.getEmployeeId()); dataMap.put("jobNum", simpleEmployee.getWorkcode()); diff --git a/src/com/engine/salary/enums/datacollection/EnumAddUpDeductionRequestStatus.java b/src/com/engine/salary/enums/datacollection/EnumAddUpDeductionRequestStatus.java new file mode 100644 index 000000000..49cda3f90 --- /dev/null +++ b/src/com/engine/salary/enums/datacollection/EnumAddUpDeductionRequestStatus.java @@ -0,0 +1,52 @@ +package com.engine.salary.enums.datacollection; + +import java.util.HashMap; +import java.util.Map; + +/** + * 绱闄勫姞鎵i櫎璇锋眰澶栭儴鎺ュ彛澶勭悊鐘舵 + * + * @author chengliming + * @date 2021-10-26 16:50:52 + */ +@SuppressWarnings("squid:S00115") +public enum EnumAddUpDeductionRequestStatus { + + /** + * 寰呭鐞嗭紙搴熷純锛 + */ + READY(10), + /** + * 澶勭悊涓 + */ + RUNNING(20), + /** + * 宸插畬鎴 + */ + COMPLETED(99), + ; + + private final Integer value; + + private static final Map VALUE_NAME_MAP; + + static { + final EnumAddUpDeductionRequestStatus[] values = EnumAddUpDeductionRequestStatus.values(); + VALUE_NAME_MAP = new HashMap<>(values.length); + for (EnumAddUpDeductionRequestStatus value : values) { + VALUE_NAME_MAP.put(value.getValue(), value.name()); + } + } + + EnumAddUpDeductionRequestStatus(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + public static String getName(int index) { + return VALUE_NAME_MAP.get(index); + } +} diff --git a/src/com/engine/salary/maintainer/salaryacct/SalaryAcctManager.java b/src/com/engine/salary/maintainer/salaryacct/SalaryAcctManager.java index 207bd1649..1c3c7da23 100644 --- a/src/com/engine/salary/maintainer/salaryacct/SalaryAcctManager.java +++ b/src/com/engine/salary/maintainer/salaryacct/SalaryAcctManager.java @@ -4,20 +4,23 @@ import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.datacollection.dto.AttendQuoteFieldListDTO; -import com.engine.salary.entity.salaryacct.bo.SalaryAcctCalculateBO; -import com.engine.salary.entity.salaryacct.bo.SalaryAcctCalculatePriorityBO; import com.engine.salary.entity.progress.ProgressDTO; +import com.engine.salary.entity.salaryacct.bo.SalaryAcctCalculateBO; +import com.engine.salary.entity.salaryacct.bo.SalaryCalcItem; +import com.engine.salary.entity.salaryacct.bo.SalaryCalcItemGraph; import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO; import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO; import com.engine.salary.entity.salaryacct.po.SalaryAcctResultTempPO; import com.engine.salary.entity.salaryformula.ExpressFormula; +import com.engine.salary.entity.salaryformula.po.FormulaVar; import com.engine.salary.entity.salaryitem.po.SalaryItemPO; import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO; import com.engine.salary.entity.salarysob.po.SalarySobAdjustRulePO; import com.engine.salary.entity.salarysob.po.SalarySobBackItemPO; import com.engine.salary.entity.salarysob.po.SalarySobItemPO; import com.engine.salary.entity.salarysob.po.SalarySobPO; +import com.engine.salary.enums.salaryformula.SalaryFormulaReferenceEnum; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.mapper.salaryacct.SalaryAcctResultMapper; import com.engine.salary.service.*; @@ -38,6 +41,7 @@ import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang.math.NumberUtils; import org.apache.commons.lang3.StringUtils; +import org.jetbrains.annotations.NotNull; import org.springframework.beans.BeanUtils; import org.springframework.jdbc.datasource.DataSourceTransactionManager; import weaver.hrm.User; @@ -47,8 +51,11 @@ import java.util.*; import java.util.concurrent.BlockingDeque; import java.util.concurrent.CountDownLatch; import java.util.concurrent.LinkedBlockingDeque; +import java.util.regex.Matcher; import java.util.stream.Collectors; +import static com.engine.salary.constant.SalaryFormulaFieldConstant.SALARY_PATTERN; + /** * 钖祫鏍哥畻缁存姢绫 *

Copyright: Copyright (c) 2022

@@ -294,9 +301,10 @@ public class SalaryAcctManager extends Service { formulaIds.addAll(SalaryEntityUtil.properties(salarySobBackItems, SalarySobBackItemPO::getFormulaId)); List expressFormulas = getSalaryFormulaService(user).listExpressFormula(formulaIds); // 鏈杩愮畻鐨勫洖绠楄柂璧勯」鐩墍娑夊強鐨勫彉閲 - Set issuedFieldIds = new HashSet<>(); + Set issuedFieldIds = getIssuedFieldIds(salarySobBackItems); // 9銆佽绠楄柂璧勯」鐩殑杩愮畻浼樺厛绾 - List> salarySobItemsWithPriority = SalaryAcctCalculatePriorityBO.calculatePriority(salarySobItemPOS, salaryItemPOS, expressFormulas, salarySobBackItems, issuedFieldIds); +// List> salarySobItemsWithPriority = SalaryAcctCalculatePriorityBO.calculatePriority(salarySobItemPOS, salaryItemPOS, expressFormulas, salarySobBackItems, issuedFieldIds); + List salarySobItemsWithPriority = sortItems(salarySobItemPOS, salarySobBackItems, salaryItemPOS, expressFormulas); // 10銆佹牴鎹甶d鏌ヨ鍏朵粬鍚堝苟璁$◣鐨勮柂璧勬牳绠楄褰 List otherSalaryAcctRecordPOS = getSalaryAcctRecordService(user).listById4OtherConsolidatedTax(salaryAcctRecordPO.getId()); // 11銆佹煡璇㈡湰娆℃牳绠椾汉鍛 @@ -396,5 +404,43 @@ public class SalaryAcctManager extends Service { getSalaryAcctResultTempService(user).deleteByCalculateKey(calculateKey); } + @NotNull + private List sortItems(List salarySobItemPOS, List salarySobBackItems, List salaryItemPOS, List expressFormulas) { + List temp = salarySobBackItems.stream() + .map(e -> { + SalarySobItemPO salarySobItem = new SalarySobItemPO(); + BeanUtils.copyProperties(e, salarySobItem); + return salarySobItem; + }).collect(Collectors.toList()); + salarySobItemPOS.addAll(temp); + + SalaryCalcItemGraph salaryCalcItemGraph = new SalaryCalcItemGraph(salarySobItemPOS, salaryItemPOS, expressFormulas); + List salaryCalcItems = salaryCalcItemGraph.sort(); + return SalaryEntityUtil.properties(salaryCalcItems, SalaryCalcItem::getSalaryItemId, Collectors.toList()); + } + + /** + * 鑾峰彇鍥炵畻鍙橀噺 + * + * @param salarySobBackItems + * @return + */ + @NotNull + private Set getIssuedFieldIds(List salarySobBackItems) { + Set issuedFieldIds; + Set issuedFormulaIds = SalaryEntityUtil.properties(salarySobBackItems, SalarySobBackItemPO::getFormulaId); + List expressFormulas1 = getSalaryFormulaService(user).listExpressFormula(issuedFormulaIds); + List issuedFormulaVars = new ArrayList<>(); + expressFormulas1.forEach(f -> issuedFormulaVars.addAll(f.getParameters())); + issuedFieldIds = issuedFormulaVars.stream() + .map(FormulaVar::getFieldId) + .filter(StringUtils::isNotBlank) + .filter(v -> v.startsWith(SalaryFormulaReferenceEnum.ISSUED.getValue() + "_")) + .map(SALARY_PATTERN::matcher) + .filter(Matcher::find) + .map(m -> m.group(2)) + .collect(Collectors.toSet()); + return issuedFieldIds; + } } diff --git a/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestFailMapper.java b/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestFailMapper.java new file mode 100644 index 000000000..1a2287833 --- /dev/null +++ b/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestFailMapper.java @@ -0,0 +1,80 @@ +package com.engine.salary.mapper.datacollection; + +import com.engine.salary.entity.datacollection.po.AddUpDeductionRequestFailPO; +import com.engine.salary.entity.datacollection.po.AddUpDeductionRequestPO; +import org.apache.ibatis.annotations.Param; + +import java.util.Collection; +import java.util.List; + +public interface AddUpDeductionRequestFailMapper { + + /** + * 鏌ヨ鎵鏈夎褰 + * + * @return 杩斿洖闆嗗悎锛屾病鏈夎繑鍥炵┖List + */ + List listAll(); + + /** + * 鏉′欢鏌ヨ + * + * @return 杩斿洖闆嗗悎锛屾病鏈夎繑鍥炵┖List + */ + List listSome(AddUpDeductionRequestFailPO addUpDeductionReqFail); + + + /** + * 鏍规嵁涓婚敭鏌ヨ + * + * @param id 涓婚敭 + * @return 杩斿洖璁板綍锛屾病鏈夎繑鍥瀗ull + */ + AddUpDeductionRequestFailPO getById(Long id); + + /** + * 鏂板锛屽拷鐣ull瀛楁 + * + * @param addUpDeductionReqFail 鏂板鐨勮褰 + * @return 杩斿洖褰卞搷琛屾暟 + */ + int insertIgnoreNull(AddUpDeductionRequestFailPO addUpDeductionReqFail); + + /** + * 鎵归噺鎻掑叆 + * + * @param list + */ + void batchInsert(@Param("collection") Collection list); + + /** + * 淇敼锛屼慨鏀规墍鏈夊瓧娈 + * + * @param addUpDeductionReqFail 淇敼鐨勮褰 + * @return 杩斿洖褰卞搷琛屾暟 + */ + int update(AddUpDeductionRequestFailPO addUpDeductionReqFail); + + /** + * 淇敼锛屽拷鐣ull瀛楁 + * + * @param addUpDeductionReqFail 淇敼鐨勮褰 + * @return 杩斿洖褰卞搷琛屾暟 + */ + int updateIgnoreNull(AddUpDeductionRequestFailPO addUpDeductionReqFail); + + /** + * 鍒犻櫎璁板綍 + * + * @param addUpDeductionReqFail 寰呭垹闄ょ殑璁板綍 + * @return 杩斿洖褰卞搷琛屾暟 + */ + int delete(AddUpDeductionRequestFailPO addUpDeductionReqFail); + + /** + * 鎵归噺鍒犻櫎璁板綍 + * @param ids 涓婚敭id闆嗗悎 + */ + void deleteByIds(@Param("ids") Collection ids); + +} \ No newline at end of file diff --git a/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestFailMapper.xml b/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestFailMapper.xml new file mode 100644 index 000000000..e0e740698 --- /dev/null +++ b/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestFailMapper.xml @@ -0,0 +1,384 @@ + + + + + + + + + + + + + + + + + + + + + + t + . + create_time + , t.creator + , t.delete_type + , t.employee_id + , t.employee_type + , t.id + , t.outer_request_id + , t.reason + , t.request_id + , t.tax_agent_id + , t.tax_year_month + , t.tenant_key + , t.update_time + + + + + + + + + + + + + + + INSERT INTO hrsa_add_up_deduction_req_fail + + + + create_time, + + + creator, + + + delete_type, + + + employee_id, + + + employee_type, + + + id, + + + outer_request_id, + + + reason, + + + request_id, + + + tax_agent_id, + + + tax_year_month, + + + tenant_key, + + + update_time, + + + + + #{createTime}, + + + #{creator}, + + + #{deleteType}, + + + #{employeeId}, + + + #{employeeType}, + + + #{id}, + + + #{outerRequestId}, + + + #{reason}, + + + #{requestId}, + + + #{taxAgentId}, + + + #{taxYearMonth}, + + + #{tenantKey}, + + + #{updateTime}, + + + + + + + INSERT INTO hrsa_add_up_deduction_req_fail (id, create_time, update_time, creator, delete_type, tenant_key, + request_id, + employee_id, employee_type, tax_agent_id, reason, tax_year_month, + outer_request_id) + VALUES + + ( + #{item.id}, + #{item.createTime}, + #{item.updateTime}, + #{item.creator}, + #{item.deleteType}, + #{item.tenantKey}, + #{item.requestId}, + #{item.employeeId}, + #{item.employeeType}, + #{item.taxAgentId}, + #{item.reason}, + #{item.taxYearMonth}, + #{item.outerRequestId} + ) + + + + INSERT INTO hrsa_add_up_deduction_req_fail (id, create_time, update_time, creator, delete_type, tenant_key, + request_id, + employee_id, employee_type, tax_agent_id, reason, tax_year_month, + outer_request_id) + VALUES + + ( + #{item.id}, + #{item.createTime}, + #{item.updateTime}, + #{item.creator}, + #{item.deleteType}, + #{item.tenantKey}, + #{item.requestId}, + #{item.employeeId}, + #{item.employeeType}, + #{item.taxAgentId}, + #{item.reason}, + #{item.taxYearMonth}, + #{item.outerRequestId} + ) + + + + INSERT INTO hrsa_add_up_deduction_req_fail (id, create_time, update_time, creator, delete_type, tenant_key, + request_id, + employee_id, employee_type, tax_agent_id, reason, tax_year_month, + outer_request_id) + + + select + #{item.id}, + #{item.createTime}, + #{item.updateTime}, + #{item.creator}, + #{item.deleteType}, + #{item.tenantKey}, + #{item.requestId}, + #{item.employeeId}, + #{item.employeeType}, + #{item.taxAgentId}, + #{item.reason}, + #{item.taxYearMonth}, + #{item.outerRequestId} + from dual + + + + INSERT INTO hrsa_add_up_deduction_req_fail (id, create_time, update_time, creator, delete_type, tenant_key, + request_id, + employee_id, employee_type, tax_agent_id, reason, tax_year_month, + outer_request_id) + VALUES + + ( + #{item.id}, + #{item.createTime}, + #{item.updateTime}, + #{item.creator}, + #{item.deleteType}, + #{item.tenantKey}, + #{item.requestId}, + #{item.employeeId}, + #{item.employeeType}, + #{item.taxAgentId}, + #{item.reason}, + #{item.taxYearMonth}, + #{item.outerRequestId} + ) + + + + + + UPDATE hrsa_add_up_deduction_req_fail + + create_time=#{createTime}, + creator=#{creator}, + delete_type=#{deleteType}, + employee_id=#{employeeId}, + employee_type=#{employeeType}, + outer_request_id=#{outerRequestId}, + reason=#{reason}, + request_id=#{requestId}, + tax_agent_id=#{taxAgentId}, + tax_year_month=#{taxYearMonth}, + tenant_key=#{tenantKey}, + update_time=#{updateTime}, + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_add_up_deduction_req_fail + + + create_time=#{createTime}, + + + creator=#{creator}, + + + delete_type=#{deleteType}, + + + employee_id=#{employeeId}, + + + employee_type=#{employeeType}, + + + outer_request_id=#{outerRequestId}, + + + reason=#{reason}, + + + request_id=#{requestId}, + + + tax_agent_id=#{taxAgentId}, + + + tax_year_month=#{taxYearMonth}, + + + tenant_key=#{tenantKey}, + + + update_time=#{updateTime}, + + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_add_up_deduction_req_fail + SET delete_type=1 + WHERE id = #{id} + AND delete_type = 0 + + + + UPDATE hrsa_add_up_deduction_req_fail + 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/mapper/datacollection/AddUpDeductionRequestMapper.java b/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestMapper.java new file mode 100644 index 000000000..5df335a15 --- /dev/null +++ b/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestMapper.java @@ -0,0 +1,80 @@ +package com.engine.salary.mapper.datacollection; + +import com.engine.salary.entity.datacollection.po.AddUpDeductionRequestPO; +import org.apache.ibatis.annotations.Param; + +import java.util.Collection; +import java.util.List; + +public interface AddUpDeductionRequestMapper { + + /** + * 鏌ヨ鎵鏈夎褰 + * + * @return 杩斿洖闆嗗悎锛屾病鏈夎繑鍥炵┖List + */ + List listAll(); + + /** + * 鏉′欢鏌ヨ + * + * @return 杩斿洖闆嗗悎锛屾病鏈夎繑鍥炵┖List + */ + List listSome(AddUpDeductionRequestPO addUpDeductionRequest); + + + /** + * 鏍规嵁涓婚敭鏌ヨ + * + * @param id 涓婚敭 + * @return 杩斿洖璁板綍锛屾病鏈夎繑鍥瀗ull + */ + AddUpDeductionRequestPO getById(Long id); + + /** + * 鏂板锛屽拷鐣ull瀛楁 + * + * @param addUpDeductionRequest 鏂板鐨勮褰 + * @return 杩斿洖褰卞搷琛屾暟 + */ + int insertIgnoreNull(AddUpDeductionRequestPO addUpDeductionRequest); + + /** + * 鎵归噺鎻掑叆 + * + * @param addUpDeductionRequest + */ + void batchInsert(@Param("collection") List addUpDeductionRequest); + + /** + * 淇敼锛屼慨鏀规墍鏈夊瓧娈 + * + * @param addUpDeductionRequest 淇敼鐨勮褰 + * @return 杩斿洖褰卞搷琛屾暟 + */ + int update(AddUpDeductionRequestPO addUpDeductionRequest); + + /** + * 淇敼锛屽拷鐣ull瀛楁 + * + * @param addUpDeductionRequest 淇敼鐨勮褰 + * @return 杩斿洖褰卞搷琛屾暟 + */ + int updateIgnoreNull(AddUpDeductionRequestPO addUpDeductionRequest); + + /** + * 鍒犻櫎璁板綍 + * + * @param addUpDeductionRequest 寰呭垹闄ょ殑璁板綍 + * @return 杩斿洖褰卞搷琛屾暟 + */ + int delete(AddUpDeductionRequestPO addUpDeductionRequest); + + /** + * 鎵归噺鍒犻櫎璁板綍 + * @param ids 涓婚敭id闆嗗悎 + */ + void deleteByIds(@Param("ids") Collection ids); + + int updateRequestStatusLockVersion(AddUpDeductionRequestPO build); +} \ No newline at end of file diff --git a/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestMapper.xml b/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestMapper.xml new file mode 100644 index 000000000..b25dca50d --- /dev/null +++ b/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestMapper.xml @@ -0,0 +1,388 @@ + + + + + + + + + + + + + + + + + + + + + t + . + create_time + , t.creator + , t.delete_type + , t.id + , t.lock_version + , t.outer_request_id + , t.request_id + , t.request_status + , t.tax_agent_id + , t.tax_year_month + , t.tenant_key + , t.update_time + + + + + + + + + + + + + + + INSERT INTO hrsa_add_up_deduction_request + + + + create_time, + + + creator, + + + delete_type, + + + id, + + + lock_version, + + + outer_request_id, + + + request_id, + + + request_status, + + + tax_agent_id, + + + tax_year_month, + + + tenant_key, + + + update_time, + + + + + #{createTime}, + + + #{creator}, + + + #{deleteType}, + + + #{id}, + + + #{lockVersion}, + + + #{outerRequestId}, + + + #{requestId}, + + + #{requestStatus}, + + + #{taxAgentId}, + + + #{taxYearMonth}, + + + #{tenantKey}, + + + #{updateTime}, + + + + + + + + INSERT INTO hrsa_add_up_deduction_request + ( + create_time, + creator, + delete_type, + id, + lock_version, + outer_request_id, + request_id, + request_status, + tax_agent_id, + tax_year_month, + tenant_key, + update_time + ) + VALUES + ( + + #{item.createTime}, + #{item.creator}, + #{item.deleteType}, + #{item.id}, + #{item.lockVersion}, + #{item.outerRequestId}, + #{item.requestId}, + #{item.requestStatus}, + #{item.taxAgentId}, + #{item.taxYearMonth}, + #{item.tenantKey}, + #{item.updateTime} + + ) + + + + + INSERT INTO hrsa_add_up_deduction_request ( + create_time, + creator, + delete_type, + id, + lock_version, + outer_request_id, + request_id, + request_status, + tax_agent_id, + tax_year_month, + tenant_key, + update_time + ) + + select + #{item.createTime,jdbcType=DATE}, + #{item.creator,jdbcType=DOUBLE}, + #{item.deleteType,jdbcType=INTEGER}, + #{item.id,jdbcType=DOUBLE}, + #{item.lockVersion,jdbcType=INTEGER}, + #{item.outerRequestId,jdbcType=DOUBLE}, + #{item.requestId,jdbcType=DOUBLE}, + #{item.requestStatus,jdbcType=INTEGER}, + #{item.taxAgentId,jdbcType=DOUBLE}, + #{item.taxYearMonth,jdbcType=DATE}, + #{item.tenantKey,jdbcType=VARCHAR}, + #{item.updateTime,jdbcType=DATE} + from dual + + + + + + + INSERT INTO hrsa_add_up_deduction_request ( + create_time, + creator, + delete_type, + id, + lock_version, + outer_request_id, + request_id, + request_status, + tax_agent_id, + tax_year_month, + tenant_key, + update_time + ) + VALUES + ( + #{item.createTime}, + #{item.creator}, + #{item.deleteType}, + #{item.id}, + #{item.lockVersion}, + #{item.outerRequestId}, + #{item.requestId}, + #{item.requestStatus}, + #{item.taxAgentId}, + #{item.taxYearMonth}, + #{item.tenantKey}, + #{item.updateTime} + ) + + + + + + UPDATE hrsa_add_up_deduction_request + + create_time=#{createTime}, + creator=#{creator}, + delete_type=#{deleteType}, + lock_version=#{lockVersion}, + outer_request_id=#{outerRequestId}, + request_id=#{requestId}, + request_status=#{requestStatus}, + tax_agent_id=#{taxAgentId}, + tax_year_month=#{taxYearMonth}, + tenant_key=#{tenantKey}, + update_time=#{updateTime}, + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_add_up_deduction_request + + + create_time=#{createTime}, + + + creator=#{creator}, + + + delete_type=#{deleteType}, + + + lock_version=#{lockVersion}, + + + outer_request_id=#{outerRequestId}, + + + request_id=#{requestId}, + + + request_status=#{requestStatus}, + + + tax_agent_id=#{taxAgentId}, + + + tax_year_month=#{taxYearMonth}, + + + tenant_key=#{tenantKey}, + + + update_time=#{updateTime}, + + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_add_up_deduction_request + SET delete_type=1 + WHERE id = #{id} + AND delete_type = 0 + + + + UPDATE hrsa_add_up_deduction_request + SET delete_type = 1 + WHERE delete_type = 0 + AND id IN + + #{id} + + + + + UPDATE hrsa_add_up_deduction_request + + request_status=#{requestStatus}, + lock_version=#{lockVersion}, + update_time=#{updateTime}, + + WHERE delete_type = 0 + AND request_status=#{oldStatus} + AND lock_version=#{oldLockVersion} + AND id = #{id} + + + \ No newline at end of file diff --git a/src/com/engine/salary/mapper/datacollection/AddUpSituationMapper.xml b/src/com/engine/salary/mapper/datacollection/AddUpSituationMapper.xml index 1a4e58158..9e309c506 100644 --- a/src/com/engine/salary/mapper/datacollection/AddUpSituationMapper.xml +++ b/src/com/engine/salary/mapper/datacollection/AddUpSituationMapper.xml @@ -20,6 +20,9 @@ + + + @@ -64,6 +67,9 @@ , t.add_up_tax_savings , t.add_up_infant_care , t.add_up_private_pension + , t.actual_add_up_advance_tax + , t.tax_adjustment + , t.add_up_taxable_income @@ -126,7 +132,10 @@ t1.add_up_tax_exempt_income, t1.add_up_allowed_donation, t1.add_up_tax_savings, - t1.add_up_advance_tax + t1.add_up_advance_tax, + t1.actual_add_up_advance_tax, + t1.tax_adjustment, + t1.add_up_taxable_income @@ -438,7 +447,10 @@ add_up_tax_savings, add_up_illness_medical, add_up_infant_care, - add_up_private_pension + add_up_private_pension, + actual_add_up_advance_tax, + tax_adjustment, + add_up_taxable_income ) VALUES @@ -468,7 +480,10 @@ #{item.addUpTaxSavings}, #{item.addUpIllnessMedical}, #{item.addUpInfantCare}, - #{item.addUpPrivatePension} + #{item.addUpPrivatePension}, + #{item.actualAddUpAdvanceTax}, + #{item.taxAdjustment}, + #{item.addUpTaxableIncome} ) @@ -499,7 +514,10 @@ add_up_tax_savings, add_up_illness_medical, add_up_infant_care, - add_up_private_pension + add_up_private_pension, + actual_add_up_advance_tax, + tax_adjustment, + add_up_taxable_income ) @@ -529,7 +547,10 @@ #{item.addUpTaxSavings,jdbcType=VARCHAR}, #{item.addUpIllnessMedical,jdbcType=VARCHAR}, #{item.addUpInfantCare,jdbcType=VARCHAR}, - #{item.addUpPrivatePension,jdbcType=VARCHAR} + #{item.addUpPrivatePension,jdbcType=VARCHAR}, + #{item.actualAddUpAdvanceTax,jdbcType=VARCHAR}, + #{item.taxAdjustment,jdbcType=VARCHAR}, + #{item.addUpTaxableIncome,jdbcType=VARCHAR} from dual @@ -561,7 +582,10 @@ add_up_tax_savings, add_up_illness_medical, add_up_infant_care, - add_up_private_pension + add_up_private_pension, + actual_add_up_advance_tax, + tax_adjustment, + add_up_taxable_income ) VALUES ( @@ -590,7 +614,10 @@ #{item.addUpTaxSavings}, #{item.addUpIllnessMedical}, #{item.addUpInfantCare}, - #{item.addUpPrivatePension} + #{item.addUpPrivatePension}, + #{item.actualAddUpAdvanceTax}, + #{item.taxAdjustment}, + #{item.addUpTaxableIncome} ) @@ -724,6 +751,27 @@ + + + + when id=#{item.id} then #{item.actualAddUpAdvanceTax} + + + + + + + when id=#{item.id} then #{item.taxAdjustment} + + + + + + + when id=#{item.id} then #{item.addUpTaxableIncome} + + + where id in diff --git a/src/com/engine/salary/mapper/employeedeclare/EmployeeDeclareMapper.xml b/src/com/engine/salary/mapper/employeedeclare/EmployeeDeclareMapper.xml index e137ec1ab..5f8eab4af 100644 --- a/src/com/engine/salary/mapper/employeedeclare/EmployeeDeclareMapper.xml +++ b/src/com/engine/salary/mapper/employeedeclare/EmployeeDeclareMapper.xml @@ -202,6 +202,12 @@ #{id} + + AND tax_agent_id IN + + #{taxAgentId} + + ORDER BY id DESC diff --git a/src/com/engine/salary/mapper/salaryacct/SalaryAcctTaxAgentMapper.java b/src/com/engine/salary/mapper/salaryacct/SalaryAcctTaxAgentMapper.java new file mode 100644 index 000000000..ce3c104a4 --- /dev/null +++ b/src/com/engine/salary/mapper/salaryacct/SalaryAcctTaxAgentMapper.java @@ -0,0 +1,26 @@ +package com.engine.salary.mapper.salaryacct; + +import com.engine.salary.entity.salaryacct.po.SalaryAcctTaxAgentPO; +import org.apache.ibatis.annotations.Param; + +import java.util.Collection; +import java.util.List; + +/** + * @description: 钖祫鏍哥畻璁板綍瀵瑰簲鐨勪釜绋庢墸缂翠箟鍔′汉 + * @author: xiajun + * @modified By: xiajun + * @date: Created in 2022/11/22 1:47 PM + * @version:v1.0 + */ +public interface SalaryAcctTaxAgentMapper { + + /** + * 鑾峰彇鏍哥畻璁板綍鍜屾墸缂翠箟鍔′汉瀵瑰簲鍏崇郴 + * @param salaryAcctIds + * @return + */ + List listAcctTaxAgent(@Param("salaryAcctRecordIds") Collection salaryAcctIds); + + List listByTaxCycleRange(SalaryAcctTaxAgentPO queryWrapper); +} diff --git a/src/com/engine/salary/mapper/salaryacct/SalaryAcctTaxAgentMapper.xml b/src/com/engine/salary/mapper/salaryacct/SalaryAcctTaxAgentMapper.xml new file mode 100644 index 000000000..e9ed7eb66 --- /dev/null +++ b/src/com/engine/salary/mapper/salaryacct/SalaryAcctTaxAgentMapper.xml @@ -0,0 +1,42 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/com/engine/salary/report/common/constant/SalaryConstant.java b/src/com/engine/salary/report/common/constant/SalaryConstant.java index b6af93d9d..4e3a32a5f 100644 --- a/src/com/engine/salary/report/common/constant/SalaryConstant.java +++ b/src/com/engine/salary/report/common/constant/SalaryConstant.java @@ -9,4 +9,35 @@ public class SalaryConstant { * 鍒楄〃涓柂璧勯」鐩姩鎬佸垪鍚庣紑鏍囪瘑 */ public static final String DYNAMIC_SUFFIX = "_salaryItem"; + + /** + * 妯″潡鏍囪瘑 + */ + public static final String MODULE = "hrmsalary"; + + /** + * 鍏叡绉熸埛鏍囪瘑 + */ + public static final String DEFAULT_TENANT_KEY = "all_teams"; + /** + * 閫氱敤鐨勫垎闅旂 + */ + public static final String COMMON_SEPARATOR = "-"; + /** + * 涓嬪垝绾 + */ + public static final String FORMULA_VAR_SEPARATOR = "_"; + /** + * 涓嬪垝绾垮垎闅旂 + */ + public static final String UNDERLINE_SEPARATOR = "_"; + /** + * 瀹屾暣涓诲煙鍚 + */ + public static final String PRIMARY_DOMAIN = "primary.domain"; + + /** + * 鍥剧墖鍏叡鍦板潃 + */ + public static final String IMG_URL = "/papi/file/preview?type=imgs&fileId=%s&random=123456"; } diff --git a/src/com/engine/salary/service/AddUpDeductionService.java b/src/com/engine/salary/service/AddUpDeductionService.java index 51498f653..126002890 100644 --- a/src/com/engine/salary/service/AddUpDeductionService.java +++ b/src/com/engine/salary/service/AddUpDeductionService.java @@ -3,10 +3,10 @@ package com.engine.salary.service; import com.engine.salary.entity.datacollection.AddUpDeduction; import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO; import com.engine.salary.entity.datacollection.dto.AddUpDeductionRecordDTO; -import com.engine.salary.entity.datacollection.param.AddUpDeductionImportParam; -import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam; -import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordDeleteParam; -import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordParam; +import com.engine.salary.entity.datacollection.dto.AddUpDeductionRequestFailListDTO; +import com.engine.salary.entity.datacollection.dto.AddUpDeductionRequestResultDTO; +import com.engine.salary.entity.datacollection.param.*; +import com.engine.salary.entity.datacollection.po.AddUpDeductionRequestFailPO; import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO; import com.engine.salary.util.page.PageInfo; import org.apache.poi.xssf.usermodel.XSSFWorkbook; @@ -157,4 +157,43 @@ public interface AddUpDeductionService { * @author lfc */ String autoAddAll(Date yearMonth, Boolean isAdmin); + + /** + * 鍦ㄧ嚎鑾峰彇鏁版嵁 + * + * @param param + * @return + */ + Map onlineRequest(AddUpDeductionMonthTaxAgentParam param); + + /** + * 鍦ㄧ嚎鑾峰彇缁撴灉鏌ヨ + * + * @return + */ + AddUpDeductionRequestResultDTO onlineFeedback(); + + /** + * 鍦ㄧ嚎鑾峰彇澶辫触璁板綍 + * + * @param queryParam + * @return + */ + PageInfo onlineFeedbackFail(AddUpDeductionRequestFailQueryParam queryParam); + + /** + * 鑾峰彇鍙嶉澶辫触璁板綍 + * + * @param requestId + * @return + */ + List getAddUpDeductionRequestFailPOList(Long requestId); + + /** + * 瀵煎嚭鍙嶉澶辫触璁板綍 + * + * @param requestId + */ + XSSFWorkbook exportOnlineFeedbackFail(Long requestId); + } diff --git a/src/com/engine/salary/service/AddUpSituationService.java b/src/com/engine/salary/service/AddUpSituationService.java index 2406e16be..ccfc26231 100644 --- a/src/com/engine/salary/service/AddUpSituationService.java +++ b/src/com/engine/salary/service/AddUpSituationService.java @@ -112,4 +112,12 @@ public interface AddUpSituationService { * @date 2022/10/31 14:00 */ AddUpSituationRecordDTO getAddUpSituation(AddUpSituationParam addUpSituationParam); + + /** + * 鍦ㄧ嚎鑾峰彇瀹為檯绱宸查鎵i缂寸◣棰 + * + * @param param + * @return + */ + Map onlineRequest(AddUpDeductionMonthTaxAgentParam param); } diff --git a/src/com/engine/salary/service/SalaryAcctRecordService.java b/src/com/engine/salary/service/SalaryAcctRecordService.java index 4e7c8eb2e..51eb656e1 100644 --- a/src/com/engine/salary/service/SalaryAcctRecordService.java +++ b/src/com/engine/salary/service/SalaryAcctRecordService.java @@ -124,6 +124,13 @@ public interface SalaryAcctRecordService { */ Long save(SalaryAcctRecordSaveParam saveParam); + /** + * 淇濆瓨涔嬪墠妫鏌ヤ竴涓嬫槸鍚﹀彲浠ユ柊寤烘牳绠 + * + * @param salaryAcctTaxAgents + */ + void checkBeforeSave(SalaryAcctRecordPO salaryAcctRecord, List salaryAcctTaxAgents); + /** * 鏇存柊钖祫鏍哥畻璁板綍鐨勭姸鎬 * diff --git a/src/com/engine/salary/service/SalaryAcctTaxAgentService.java b/src/com/engine/salary/service/SalaryAcctTaxAgentService.java index be75f76bf..e2796aa4a 100644 --- a/src/com/engine/salary/service/SalaryAcctTaxAgentService.java +++ b/src/com/engine/salary/service/SalaryAcctTaxAgentService.java @@ -1,7 +1,6 @@ package com.engine.salary.service; import com.engine.salary.common.YearMonthRange; -import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO; import com.engine.salary.entity.salaryacct.po.SalaryAcctTaxAgentPO; import java.util.Collection; @@ -33,25 +32,25 @@ public interface SalaryAcctTaxAgentService { */ List listByTaxCycleRange(YearMonthRange taxCycleRange); - /** - * 鏍规嵁钖祫鏍哥畻浜哄憳鍒濆鍖 - * - * @param salaryAcctEmployees - * @return - */ - List initBySalaryAcctEmployees(List salaryAcctEmployees); - - /** - * 鎵归噺淇濆瓨 - * - * @param salaryAcctTaxAgents - */ - void batchSave(List salaryAcctTaxAgents); - - /** - * 鏍规嵁钖祫鏍哥畻璁板綍id鍒犻櫎鍏宠仈鐨勪釜绋庢墸缂翠箟鍔′汉 - * - * @param salaryAcctRecordIds - */ - void deleteBySalaryAcctRecordIds(Collection salaryAcctRecordIds); +// /** +// * 鏍规嵁钖祫鏍哥畻浜哄憳鍒濆鍖 +// * +// * @param salaryAcctEmployees +// * @return +// */ +// List initBySalaryAcctEmployees(List salaryAcctEmployees); +// +// /** +// * 鎵归噺淇濆瓨 +// * +// * @param salaryAcctTaxAgents +// */ +// void batchSave(List salaryAcctTaxAgents); +// +// /** +// * 鏍规嵁钖祫鏍哥畻璁板綍id鍒犻櫎鍏宠仈鐨勪釜绋庢墸缂翠箟鍔′汉 +// * +// * @param salaryAcctRecordIds +// */ +// void deleteBySalaryAcctRecordIds(Collection salaryAcctRecordIds); } diff --git a/src/com/engine/salary/service/SalaryArchiveService.java b/src/com/engine/salary/service/SalaryArchiveService.java index 60719fc0c..642cb5535 100644 --- a/src/com/engine/salary/service/SalaryArchiveService.java +++ b/src/com/engine/salary/service/SalaryArchiveService.java @@ -247,4 +247,6 @@ public interface SalaryArchiveService { * @return */ Map getAzRyflInfo(List asList); + + List listByRunStatus(List asList); } diff --git a/src/com/engine/salary/service/TaxDeclarationService.java b/src/com/engine/salary/service/TaxDeclarationService.java index 4e7d0e3ce..2731904a5 100644 --- a/src/com/engine/salary/service/TaxDeclarationService.java +++ b/src/com/engine/salary/service/TaxDeclarationService.java @@ -1,5 +1,6 @@ package com.engine.salary.service; +import com.engine.salary.common.YearMonthRange; import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationListQueryParam; @@ -59,4 +60,14 @@ public interface TaxDeclarationService { void deleteByTaxDeclareRecordIds(Collection taxDeclareRecordIds); void saveBatch(List taxDeclarations); + + + /** + * 鏍规嵁绋庢鎵灞炴湡鏌ヨ涓◣鐢虫姤琛 + * + * @param yearMonthRange + * @return + */ + List listByTaxCycleRange(YearMonthRange yearMonthRange); + } diff --git a/src/com/engine/salary/service/impl/AbstractTaxPaymentService.java b/src/com/engine/salary/service/impl/AbstractTaxPaymentService.java index dfb4be9c4..2b001a10c 100644 --- a/src/com/engine/salary/service/impl/AbstractTaxPaymentService.java +++ b/src/com/engine/salary/service/impl/AbstractTaxPaymentService.java @@ -155,7 +155,7 @@ public abstract class AbstractTaxPaymentService extends Service implements TaxPa .orElse(null); String requestId = Optional.ofNullable(queryResponse) .map(QuerySpecialAmountResponse::getBody) - .map(QuerySpecialAmountResponse.QuerySpecialAmountBody::getRequestId) + .map(QuerySpecialAmountResponse.Body::getRequestId) .orElse(null); if (!SzyhApiConstant.SUCCESS_CODE.equals(responseCode) || StringUtils.isEmpty(requestId)) { log.info("getAsyncQueryResponse4Payment code error锛歿}", JSON.toJSONString(queryResponse)); diff --git a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java index bb0242cf4..d25f8f864 100644 --- a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java @@ -1,6 +1,7 @@ package com.engine.salary.service.impl; import cn.hutool.core.date.DateUtil; +import com.alibaba.fastjson.JSON; import com.api.browser.bean.SearchConditionGroup; import com.api.browser.bean.SearchConditionItem; import com.api.browser.util.ConditionFactory; @@ -11,35 +12,57 @@ import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.biz.AddUpDeductionBiz; import com.engine.salary.common.LocalDateRange; +import com.engine.salary.constant.SzyhApiConstant; import com.engine.salary.encrypt.EncryptUtil; import com.engine.salary.entity.datacollection.AddUpDeduction; import com.engine.salary.entity.datacollection.DataCollectionEmployee; +import com.engine.salary.entity.datacollection.bo.DataCollectionBO; import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO; import com.engine.salary.entity.datacollection.dto.AddUpDeductionRecordDTO; -import com.engine.salary.entity.datacollection.param.AddUpDeductionImportParam; -import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam; -import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordDeleteParam; -import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordParam; +import com.engine.salary.entity.datacollection.dto.AddUpDeductionRequestFailListDTO; +import com.engine.salary.entity.datacollection.dto.AddUpDeductionRequestResultDTO; +import com.engine.salary.entity.datacollection.param.*; +import com.engine.salary.entity.datacollection.po.AddUpDeductionRequestFailPO; +import com.engine.salary.entity.datacollection.po.AddUpDeductionRequestPO; import com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO; +import com.engine.salary.entity.datacollection.response.QuerySpecialAmountFeedbackResponse; +import com.engine.salary.entity.datacollection.response.QuerySpecialAmountResponse; +import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO; +import com.engine.salary.entity.extemp.po.ExtEmpPO; import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO; import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; +import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO; import com.engine.salary.entity.taxagent.bo.TaxAgentBO; import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO; import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO; import com.engine.salary.entity.taxagent.po.TaxAgentPO; +import com.engine.salary.entity.taxagent.po.TaxAgentTaxReturnPO; +import com.engine.salary.entity.taxagent.response.SzyhResponseHead; +import com.engine.salary.entity.taxapiflow.bo.TaxApiFlowBO; +import com.engine.salary.entity.taxapiflow.po.TaxDeclarationApiFlowRecordPO; +import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationApiConfigPO; import com.engine.salary.enums.UserStatusEnum; +import com.engine.salary.enums.datacollection.EnumAddUpDeductionRequestStatus; +import com.engine.salary.enums.datacollection.UseEmployeeTypeEnum; +import com.engine.salary.enums.employeedeclare.DeclareStatusEnum; import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum; +import com.engine.salary.enums.salaryarchive.SalaryArchiveStatusEnum; +import com.engine.salary.enums.sicategory.DeleteTypeEnum; +import com.engine.salary.enums.taxagent.TaxAgentTaxReturnStatusEnum; +import com.engine.salary.enums.taxdeclaration.EnumDeclareApiBusinessType; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.mapper.datacollection.AddUpDeductionMapper; +import com.engine.salary.mapper.datacollection.AddUpDeductionRequestFailMapper; +import com.engine.salary.mapper.datacollection.AddUpDeductionRequestMapper; +import com.engine.salary.mapper.employeedeclare.EmployeeDeclareMapper; import com.engine.salary.mapper.sys.SalarySysConfMapper; +import com.engine.salary.report.enums.EmployeeTypeEnum; import com.engine.salary.service.*; import com.engine.salary.sys.entity.po.SalarySysConfPO; import com.engine.salary.sys.entity.vo.OrderRuleVO; import com.engine.salary.sys.service.SalarySysConfService; import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl; -import com.engine.salary.util.SalaryDateUtil; -import com.engine.salary.util.SalaryEntityUtil; -import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.*; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.excel.ExcelComment; import com.engine.salary.util.excel.ExcelParseHelper; @@ -48,6 +71,9 @@ import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import dm.jdbc.util.IdGenerator; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.Validate; @@ -61,6 +87,8 @@ import java.io.InputStream; import java.text.SimpleDateFormat; import java.time.*; import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import java.util.stream.Collectors; import static com.engine.salary.constant.SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY; @@ -73,6 +101,7 @@ import static com.engine.salary.constant.SalaryDefaultTenantConstant.DEFAULT_TEN * @author qiantao * @version 1.0 **/ +@Slf4j public class AddUpDeductionServiceImpl extends Service implements AddUpDeductionService { private EncryptUtil encryptUtil = new EncryptUtil(); @@ -108,6 +137,38 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction return ServiceUtil.getService(SpecialAddDeductionServiceImpl.class, user); } + private TaxDeclarationApiConfigService getTaxDeclarationApiConfigService(User user) { + return ServiceUtil.getService(TaxDeclarationApiConfigServiceImpl.class, user); + } + + private TaxAgentTaxReturnService getTaxAgentTaxReturnService(User user) { + return ServiceUtil.getService(TaxAgentTaxReturnServiceImpl.class, user); + } + + private SalaryArchiveService getSalaryArchiveService(User user) { + return ServiceUtil.getService(SalaryArchiveServiceImpl.class, user); + } + + public TaxDeclarationApiBillingService getTaxDeclarationApiBillingService(User user) { + return ServiceUtil.getService(TaxDeclarationApiBillingServiceImpl.class, user); + } + + private EmployeeDeclareMapper getEmployeeDeclareMapper() { + return MapperProxyFactory.getProxy(EmployeeDeclareMapper.class); + } + + private AddUpDeductionRequestMapper getAddUpDeductionRequestMapper() { + return MapperProxyFactory.getProxy(AddUpDeductionRequestMapper.class); + } + + private AddUpDeductionRequestFailMapper getAddUpDeductionRequestFailMapper() { + return MapperProxyFactory.getProxy(AddUpDeductionRequestFailMapper.class); + } + + private ExtEmpService getExtEmpService(User user) { + return ServiceUtil.getService(ExtEmpServiceImpl.class, user); + } + @Override public Map getSearchCondition(Map params) { Map apidatas = new HashMap(); @@ -410,7 +471,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction throw new SalaryRunTimeException("璇ユ暟鎹笉瀛樺湪锛"); } Long taxAgentId = byId.getTaxAgentId(); - boolean canEdit = taxAgentList.stream().anyMatch(t -> Objects.equals(t.getTaxAgentId() , taxAgentId)); + boolean canEdit = taxAgentList.stream().anyMatch(t -> Objects.equals(t.getTaxAgentId(), taxAgentId)); if (!canEdit) { //娌℃湁缂栬緫鏉冮檺 throw new SalaryRunTimeException("璇ヤ釜绋庢墸缂翠箟鍔′汉鏃犳潈闄愮紪杈戞鏁版嵁锛"); @@ -440,7 +501,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction //绋庢鎵灞炴湡 String declareMonthStr = addUpDeductionRecordParam.getDeclareMonth(); - if (declareMonthStr .equals("")) { + if (declareMonthStr.equals("")) { throw new SalaryRunTimeException("绋庢鎵灞炴湡涓嶈兘涓虹┖锛"); } // 鑾峰彇鎵鏈変釜绋庢墸缂翠箟鍔′汉 @@ -468,7 +529,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction .updateTime(now) .creator((long) user.getUID()) .declareMonth(declareMonth).build(); - boolean employeeSameId = employees.stream().anyMatch(e -> Objects.equals(e.getEmployeeId() , addUpDeductionRecordParam.getEmployeeId())); + boolean employeeSameId = employees.stream().anyMatch(e -> Objects.equals(e.getEmployeeId(), addUpDeductionRecordParam.getEmployeeId())); if (!employeeSameId) { throw new SalaryRunTimeException("鍛樺伐淇℃伅涓嶅瓨鍦"); } @@ -552,7 +613,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction throw new SalaryRunTimeException("鏁版嵁涓嶅瓨鍦ㄦ垨宸茶鍒犻櫎锛"); } // 鍒ゆ柇鏄惁鍦ㄤ釜绋庢墸缂翠箟鍔′汉鑼冨洿鍐 - Optional first = taxAgentList.stream().filter(m -> Objects.equals(m.getTaxAgentId() , byId.getTaxAgentId())).findFirst(); + Optional first = taxAgentList.stream().filter(m -> Objects.equals(m.getTaxAgentId(), byId.getTaxAgentId())).findFirst(); if (!first.isPresent()) { throw new SalaryRunTimeException("涓◣鎵g即涔夊姟浜轰笉瀛樺湪鎴栦笉鍦ㄦ潈闄愯寖鍥村唴"); } @@ -587,7 +648,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction if (deleteParam.getTaxAgentId() != null && (!deleteParam.getTaxAgentId().equals(""))) { // 璁剧疆浜嗕釜绋庢墸缂翠箟鍔′汉 Long taxAgentId = SalaryEntityUtil.string2Long(deleteParam.getTaxAgentId()); - boolean canDelete = taxAgentIds.stream().anyMatch(t -> Objects.equals(t , taxAgentId)); + boolean canDelete = taxAgentIds.stream().anyMatch(t -> Objects.equals(t, taxAgentId)); if (!canDelete) { throw new SalaryRunTimeException("涓◣鎵g即涔夊姟浜轰笉瀛樺湪鎴栦笉鍦ㄦ潈闄愯寖鍥村唴!"); } @@ -636,12 +697,12 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction @Override public String autoAddAll(Date yearMonth, Boolean isAdmin) { String cacheKey = "addUpDeduction_autoAddAll_processing"; - Object objVal = Util_DataCache.getObjVal( cacheKey); - if(objVal != null){ + Object objVal = Util_DataCache.getObjVal(cacheKey); + if (objVal != null) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(135788, "涓閿疮璁¤繃浜庨绻侊紝璇风◢鍚庡啀璇")); } try { - Util_DataCache.setObjVal(cacheKey,true ); + Util_DataCache.setObjVal(cacheKey, true); //濡傛灉鏄畾鏃朵换鍔$洿鎺ユ煡璇㈡墍鏈夛紝isAdmin浼爐rue boolean isChief = Boolean.TRUE.equals(isAdmin) || getTaxAgentService(user).isChief((long) user.getUID()); @@ -969,7 +1030,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction if (getTaxAgentService(user).isOpenDevolution() && !isChief) { List taxAgentEmployees = getTaxAgentService(user).listTaxAgentAndEmployee(employeeId); List taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); -// List lastList = getLastListByModifier(employeeId, tenantKey); +// List lastList = getLastListByModifier(employeeId); list = list.stream().filter(f -> // 浣滀负绠$悊鍛 taxAgentIdsAsAdmin.contains(f.getTaxAgentId()) @@ -1200,4 +1261,487 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction return list; } + @Override + public Map onlineRequest(AddUpDeductionMonthTaxAgentParam param) { + SalaryAssert.notNull(param.getDeclareMonth(), SalaryI18nUtil.getI18nLabel(100586, "绋庢鎵灞炴湡蹇呬紶")); + // 鑾峰彇鎺ュ彛閰嶇疆 + TaxDeclarationApiConfigPO apiConfig = getTaxDeclarationApiConfigService(user).getConfig(true); + // 鑾峰彇鍖呰绫 + AddUpDeductionOnlineRequestWrapper requestWrapper = getAddUpDeductionOnlineRequestWrapper(null, apiConfig); + // 鑾峰彇鎶ョ◣淇℃伅 + List taxReturnPOList = getTaxAgentTaxReturnService(user).getByTaxAgentIds(requestWrapper.getTaxAgentMap().keySet()); + List failReturnPOList = taxReturnPOList.stream().filter(e -> !TaxAgentTaxReturnStatusEnum.SUCCESS.getValue().equals(e.getCheckStatus())).collect(Collectors.toList()); + SalaryAssert.isFalse(taxReturnPOList.size() == failReturnPOList.size(), SalaryI18nUtil.getI18nLabel(183781, "浼佷笟鏈氳繃楠岃瘉锛屾殏鏃舵棤娉曡幏鍙栫疮璁′笓椤归檮鍔犳墸闄ゆ暟鎹紝璇峰厛鍦ㄣ愪釜绋庢墸缂翠箟鍔′汉銆戣彍鍗曢獙璇佷紒涓氭姤绋庝俊鎭")); + Map result = new HashMap<>(1); + if (!failReturnPOList.isEmpty()) { + String failTaxAgentNames = failReturnPOList.stream().map(e -> requestWrapper.getTaxAgentMap().get(e.getTaxAgentId())).collect(Collectors.joining("銆")); + result.put("msg", String.format(SalaryI18nUtil.getI18nLabel(183782, "%s鏈氳繃鐧昏楠岃瘉锛屾棤娉曞湪绾胯幏鍙栨暟鎹"), failTaxAgentNames)); + } + // 鑾峰彇璇锋眰 + List requestPOList = getAddUpDeductionRequestPOS(); + SalaryAssert.isEmpty(requestPOList, SalaryI18nUtil.getI18nLabel(153341, "鑾峰彇涓紝绋嶅悗璇风偣鍑汇愯幏鍙栫粨鏋滀笅杞姐")); + // 鑾峰彇鎶ラ佹垚鍔熺殑浜哄憳鍚嶅崟 + Map> taxAgentEmpDeclareMap = getEmpDeclareMap(requestWrapper.getTaxAgentMap().keySet(), param.getDeclareMonth()); + // 寮濮嬭姹傛帴鍙h幏鍙栨暟鎹 + List querySpecialAmountBodies = getQuerySpecialAmountBodies(param, requestWrapper, taxAgentEmpDeclareMap, taxReturnPOList); + // 鎸佷箙鍖栨暟鎹 + persistFeedbackData(param, querySpecialAmountBodies); + return result; + } + + private AddUpDeductionOnlineRequestWrapper getAddUpDeductionOnlineRequestWrapper(List requestPOList, TaxDeclarationApiConfigPO apiConfig) { + boolean isOpenDevolution = getTaxAgentService(user).isOpenDevolution(); + long employeeId = (long) user.getUID(); + boolean isChief = getTaxAgentService(user).isChief(employeeId); + List taxAgents = !isOpenDevolution || isChief ? getTaxAgentService(user).listAll() : (List) getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId); + List taxAgentIdSet = SalaryEntityUtil.properties(taxAgents, TaxAgentPO::getId, Collectors.toList()); + // 鑾峰彇钖祫妗f + List salaryArchiveList = getSalaryArchiveService(user).listByRunStatus(Arrays.asList( + SalaryArchiveStatusEnum.FIXED.getValue(), + SalaryArchiveStatusEnum.SUSPEND.getValue(), + SalaryArchiveStatusEnum.STOP_FROM_SUSPEND.getValue(), + SalaryArchiveStatusEnum.STOP_FROM_PENDING.getValue()) + ); + salaryArchiveList = salaryArchiveList.stream().filter(e -> taxAgentIdSet.contains(e.getTaxAgentId())).collect(Collectors.toList()); + AddUpDeductionOnlineRequestWrapper requestWrapper = new AddUpDeductionOnlineRequestWrapper(requestPOList, salaryArchiveList, taxAgents, (long) user.getUID()); + requestWrapper.setApiConfig(apiConfig); + return requestWrapper; + } + + private Map> getEmpDeclareMap(Collection taxAgentIds, Date declareMonth) { + List employeeDeclarePOS = getEmployeeDeclarePOList(taxAgentIds, declareMonth); + SalaryAssert.notEmpty(employeeDeclarePOS, SalaryI18nUtil.getI18nLabel(183783, "鏆傛棤浜哄憳鎶ラ佺姸鎬佷负姝e父鐨勬暟鎹紝璇峰厛鎶ラ佸啀鑾峰彇绱涓撻」闄勫姞鎵i櫎鏁版嵁銆")); + return employeeDeclarePOS.stream().collect(Collectors.groupingBy(EmployeeDeclarePO::getTaxAgentId)); + } + + private List getEmployeeDeclarePOList(Collection taxAgentIds, Date declareMonth) { + return getEmployeeDeclareMapper().listSome(EmployeeDeclarePO.builder().declareStatus(DeclareStatusEnum.DECLARE_SUCCESS.getValue()).taxCycle(declareMonth).taxAgentIds(taxAgentIds).build()); + } + + private List getQuerySpecialAmountBodies(AddUpDeductionMonthTaxAgentParam param, + AddUpDeductionOnlineRequestWrapper requestWrapper, + Map> taxAgentEmployeeDeclareMap, + List taxReturnPOList) { + List queryResponseList = new ArrayList<>(); + for (TaxAgentTaxReturnPO returnPO : taxReturnPOList) { + if (!TaxAgentTaxReturnStatusEnum.SUCCESS.getValue().equals(returnPO.getCheckStatus())) { + continue; + } + // 鍙戣捣璇锋眰 + String taxAgentName = requestWrapper.getTaxAgentMap().get(returnPO.getTaxAgentId()); + List declarePOList = taxAgentEmployeeDeclareMap.getOrDefault(returnPO.getTaxAgentId(), new ArrayList<>()); + if (declarePOList.isEmpty()) { + log.info("璇ヤ富浣撲笅娌℃湁鎶ラ佹垚鍔熺殑浜哄憳锛屼富浣撳悕绉帮細{}", taxAgentName); + continue; + } + QuerySpecialAmountResponse queryResponse = getQuerySpecialAmountResponse(returnPO, taxAgentName, declarePOList, param, requestWrapper.getApiConfig()); + // 鏍¢獙璇锋眰缁撴灉 + String responseCode = Optional.ofNullable(queryResponse) + .map(QuerySpecialAmountResponse::getHead) + .map(SzyhResponseHead::getCode) + .orElse(null); + String outerRequestId = Optional.ofNullable(queryResponse) + .map(QuerySpecialAmountResponse::getBody) + .map(QuerySpecialAmountResponse.Body::getRequestId) + .orElse(null); + if (!SzyhApiConstant.SUCCESS_CODE.equals(responseCode) || StringUtils.isEmpty(outerRequestId)) { + log.info("getQuerySpecialAmountBodies error锛歿}", JSON.toJSONString(queryResponse)); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(95828, "鏈嶅姟寮傚父锛岃绋嶅悗閲嶈瘯")); + } + queryResponse.getBody().setTaxAgentId(returnPO.getTaxAgentId()); + queryResponseList.add(queryResponse.getBody()); + } + return queryResponseList; + } + + private void persistFeedbackData(AddUpDeductionMonthTaxAgentParam param, List queryResponseList) { + long requestId = IdGenerator.generate(); + for (QuerySpecialAmountResponse.Body body : queryResponseList) { + AddUpDeductionRequestPO po = AddUpDeductionRequestPO.builder() + .id(IdGenerator.generate()) + .requestId(requestId) + .taxAgentId(body.getTaxAgentId()) + .requestStatus(EnumAddUpDeductionRequestStatus.RUNNING.getValue()) + .outerRequestId(body.getRequestId()) + .taxYearMonth(param.getDeclareMonth()) + .deleteType(DeleteTypeEnum.NOT_DELETED.getValue()) + .tenantKey(DEFAULT_TENANT_KEY) + .createTime(new Date()) + .updateTime(new Date()) + .creator((long) user.getUID()) + .lockVersion(0) + .build(); + getAddUpDeductionRequestMapper().insertIgnoreNull(po); + } + } + + private QuerySpecialAmountResponse getQuerySpecialAmountResponse(TaxAgentTaxReturnPO returnPO, + String taxAgentName, + List declarePOList, + AddUpDeductionMonthTaxAgentParam param, + TaxDeclarationApiConfigPO apiConfig) { + String url = apiConfig.getHost() + SzyhApiConstant.QUERY_SPECIAL_AMOUNT; + Map requestParam = DataCollectionBO.getApiBaseQueryParams(returnPO, taxAgentName, SalaryDateUtil.getFormatYYYYMM(param.getDeclareMonth())); + requestParam.put("rylb", DataCollectionBO.getEmployeeList(declarePOList)); + String reqJson = JsonUtil.toJsonString(requestParam); + log.info("getQuerySpecialAmountResponse params --- \n{}\n", reqJson); + Map params = new HashMap<>(1); + Map header = SingnatureData.initHeader(params, apiConfig.getAppKey(), apiConfig.getAppSecret()); + // 寮濮嬭姹 + String res = HttpUtil.doPost(url, header, reqJson, HttpUtil.JSON_TYPE); + log.info("getQuerySpecialAmountResponse res --- {}", res); + return JsonUtil.parseObject(res, QuerySpecialAmountResponse.class); + } + + @Override + public AddUpDeductionRequestResultDTO onlineFeedback() { + TaxDeclarationApiConfigPO apiConfig = getTaxDeclarationApiConfigService(user).getConfig(true); + List requestPOList = getAddUpDeductionRequestPOS(); + // 鏍¢獙璇锋眰鏄惁鍚堟硶 + Long requestId = checkRequestPOList(requestPOList); + // 鍓嶇疆鏁版嵁灏佽涓哄寘瑁呯被 + AddUpDeductionOnlineRequestWrapper requestWrapper = getAddUpDeductionOnlineRequestWrapper(requestPOList, apiConfig); + // 寮濮嬭姹傚弽棣堟暟鎹 + AddUpDeductionRequestResultDTO resultDTO = getQuerySpecialAmountFeedback(requestWrapper); + // 鍒ゆ柇鏄惁闇瑕佺户缁疆璇㈡垨鑰呭紓甯搁鍑 + if (!resultDTO.getFinish()) { + return resultDTO; + } + // 鏇存柊璇锋眰鐘舵佷负宸插畬鎴 + updateRequestStatus(requestPOList, EnumAddUpDeductionRequestStatus.RUNNING.getValue(), EnumAddUpDeductionRequestStatus.COMPLETED.getValue()); + // 鑾峰彇鍛樺伐淇℃伅 + setEmployeeInfoMap(requestWrapper); + // 鑾峰彇宸插瓨鍦ㄧ殑绱闄勫姞鎵i櫎鏁版嵁 + setExistedDataMap(requestWrapper); + // 寮濮嬪鐞嗗弽棣堢粨鏋 + TaxDeclarationApiBillingServiceImpl.ApiFlowUpdateWrapper apiFlowUpdateWrapper + = new TaxDeclarationApiBillingServiceImpl.ApiFlowUpdateWrapper(requestPOList.get(0).getTaxYearMonth(), requestWrapper.getApiConfig(), EnumDeclareApiBusinessType.ADD_UP_DEDUCTION, (long) user.getUID()); + handleFeedbackData(requestWrapper, apiFlowUpdateWrapper); + // 鎸佷箙鍖栨暟鎹 + persistFeedbackData(requestWrapper); + // 鏇存柊娴侀噺缁熻鏁版嵁 + getTaxDeclarationApiBillingService(user).updateApiFlowInfo(apiFlowUpdateWrapper); + // 杩斿洖缁撴灉 + return DataCollectionBO.buildRequestResultDTO(requestId, requestWrapper); + } + + @Override + public PageInfo onlineFeedbackFail(AddUpDeductionRequestFailQueryParam queryParam) { + List addUpDeductionRequestFailPOS = getAddUpDeductionRequestFailMapper().listSome(AddUpDeductionRequestFailPO.builder().requestId(queryParam.getRequestId()).build()); + List list = SalaryPageUtil.subList(queryParam.getCurrent(), queryParam.getPageSize(), addUpDeductionRequestFailPOS); + // 鑾峰彇钖祫妗f + AddUpDeductionOnlineRequestWrapper requestWrapper = getAddUpDeductionOnlineRequestWrapper(null, null); + this.getEmployeeInfoMap(requestWrapper); + + List listDTOList = list.stream().map(requestWrapper::buildAddUpDeductionRequestFailListDTO).collect(Collectors.toList()); + + PageInfo page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), listDTOList, AddUpDeductionRequestFailListDTO.class); + page.setTotal(addUpDeductionRequestFailPOS.size()); + return page; + } + + @Override + public List getAddUpDeductionRequestFailPOList(Long requestId) { + return getAddUpDeductionRequestFailMapper().listSome(AddUpDeductionRequestFailPO.builder().requestId(requestId).build()); + } + + @Override + public XSSFWorkbook exportOnlineFeedbackFail( Long requestId) { + List> rows = new ArrayList<>(); + // 琛ㄥご + List headers = new ArrayList<>(); + headers.add(SalaryI18nUtil.getI18nLabel(85429, "濮撳悕")); + headers.add(SalaryI18nUtil.getI18nLabel(86184, "涓◣鎵g即涔夊姟浜")); + headers.add(SalaryI18nUtil.getI18nLabel(86317, "宸ュ彿")); + headers.add(SalaryI18nUtil.getI18nLabel(86185, "閮ㄩ棬")); + headers.add(SalaryI18nUtil.getI18nLabel(106277, "韬唤璇佸彿鐮")); + headers.add(SalaryI18nUtil.getI18nLabel(144832, "澶辫触鍘熷洜")); + rows.add(headers); + // 鑾峰彇钖祫妗f + AddUpDeductionOnlineRequestWrapper requestWrapper = getAddUpDeductionOnlineRequestWrapper(null, null); + // 鑾峰彇韬唤淇℃伅map + this.getEmployeeInfoMap(requestWrapper); + // 鑾峰彇鏁版嵁 + List pos = getAddUpDeductionRequestFailPOList(requestId); + // 缁勮鏁版嵁 + for (AddUpDeductionRequestFailPO po : pos) { + AddUpDeductionRequestFailListDTO failListDTO = requestWrapper.buildAddUpDeductionRequestFailListDTO(po); + List row = new ArrayList<>(); + row.add(failListDTO.getEmployeeName()); + row.add(failListDTO.getTaxAgentName()); + row.add(failListDTO.getJobNum()); + row.add(failListDTO.getDepartmentName()); + row.add(failListDTO.getIdNo()); + row.add(failListDTO.getFailReason()); + rows.add(row); + } + // 鐢熸垚琛ㄦ牸 + return ExcelUtil.genWorkbookV2(rows, "鍦ㄧ嚎鑾峰彇涓撻」闄勫姞鎵i櫎澶辫触鏁版嵁"); + } + + + private void getEmployeeInfoMap(AddUpDeductionOnlineRequestWrapper wrapper) { + // 韬唤璇佸彿 + List employeeIds = SalaryEntityUtil.properties(wrapper.getSalaryArchiveList(), SalaryArchivePO::getEmployeeId, Collectors.toList()); + List simpleUserInfos = getSalaryEmployeeService(user).listByIds(employeeIds); + Map simpleUserInfoMap = SalaryEntityUtil.convert2Map(simpleUserInfos, DataCollectionEmployee::getEmployeeId); + wrapper.setUserInfoUserIdMap(simpleUserInfoMap); + // 浜哄憳淇℃伅 + List simpleEmployees = getSalaryEmployeeService(user).listAll(UseEmployeeTypeEnum.ALL); + Map simpleEmployeeMap = SalaryEntityUtil.convert2Map(simpleEmployees, DataCollectionEmployee::getEmployeeId); + wrapper.setSimpleEmployeeMap(simpleEmployeeMap); + // 澶栭儴浜哄憳淇℃伅 + List extEmployeePOS = getExtEmpService(user).listAll(); + Map extEmployeePOMap = SalaryEntityUtil.convert2Map(extEmployeePOS, ExtEmpPO::getId, e -> e); + wrapper.setExtEmployeePOMap(extEmployeePOMap); + } + + private List getAddUpDeductionRequestPOS() { + return getAddUpDeductionRequestMapper().listSome(AddUpDeductionRequestPO.builder().requestStatus(EnumAddUpDeductionRequestStatus.RUNNING.getValue()).build()); + } + + private void handleFeedbackData(AddUpDeductionOnlineRequestWrapper requestWrapper, TaxDeclarationApiBillingServiceImpl.ApiFlowUpdateWrapper apiFlowUpdateWrapper) { + requestWrapper.getRequestFeedBackMap().forEach((outerRequestId, feedbacks) -> feedbacks.forEach(feedback -> { + DataCollectionEmployee simpleUserInfo = requestWrapper.getUserInfoIdNoMap().get(feedback.getZzhm()); + Long extEmpId = requestWrapper.getExtEmployeeIdCardMap().get(feedback.getZzhm()); + Long employeeId = Optional.ofNullable(simpleUserInfo) + .map(DataCollectionEmployee::getEmployeeId) + .orElse(extEmpId); + AddUpDeductionRequestPO requestPO = requestWrapper.getRequestPoMap().get(outerRequestId); + + // 娴侀噺浣跨敤鎯呭喌 + TaxDeclarationApiFlowRecordPO flowRecordPO = TaxApiFlowBO.buildTaxDeclarationApiFlowRecordPO(apiFlowUpdateWrapper, requestPO.getTaxAgentId(), employeeId); + + if (employeeId == null || StringUtils.isNotEmpty(feedback.getSbyy())) { + // 澶勭悊澶辫触鏁版嵁 + AddUpDeductionRequestFailPO failPO = DataCollectionBO.buildAddUpDeductionRequestFailPO(requestWrapper, requestPO, employeeId); + failPO.setReason(employeeId == null + ? String.format("璇ヤ汉鍛樻姤閫佹垚鍔熺殑韬唤璇佸彿涓庝汉浜嬫。妗堜笅鐨勮韩浠借瘉鍙蜂笉涓鑷达紝鎶ラ佷汉鍛樹俊鎭:[%s]|[%s]", feedback.getXm(), feedback.getZzhm()) + : feedback.getSbyy()); + failPO.setEmployeeType(simpleUserInfo != null ? EmployeeTypeEnum.ORGANIZATION.getValue() : + extEmpId != null ? EmployeeTypeEnum.EXT_EMPLOYEE.getValue() : 2); + requestWrapper.getFailPOList().add(failPO); + flowRecordPO.setEmployeeId(Optional.ofNullable(employeeId).orElse(0L)); + flowRecordPO.setResultStatus(TaxAgentTaxReturnStatusEnum.FAIL.getValue()); + } else { + // 澶勭悊鎴愬姛鏁版嵁 + AddUpDeduction po = DataCollectionBO.buildAddUpDeductionPO(feedback); + Long poId = requestWrapper.getExistedDataMap().get(requestPO.getTaxAgentId() + "-" + employeeId); + if (Objects.nonNull(poId)) { + po.setId(poId); + requestWrapper.getUpdateList().add(po); + } else { + setBaseInfo2PO(requestWrapper, employeeId, requestPO, po); + requestWrapper.getInsertList().add(po); + } + } + apiFlowUpdateWrapper.getApiFlowDetailPOList().add(flowRecordPO); + })); + } + + private Long checkRequestPOList(List requestPOList) { + Map> statusRequestMap = SalaryEntityUtil.group2Map(requestPOList, AddUpDeductionRequestPO::getRequestStatus); + if (CollectionUtils.isEmpty(statusRequestMap.get(EnumAddUpDeductionRequestStatus.RUNNING.getValue()))) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(153343, "璇峰厛鐐瑰嚮銆愬湪绾胯幏鍙栥戞寜閽紝閫夋嫨绋庢鎵灞炴湡杩涜鑾峰彇鏁版嵁銆")); + } + Set requestIds = SalaryEntityUtil.properties(requestPOList, AddUpDeductionRequestPO::getRequestId); + if (requestIds.size() != 1) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(153344, "褰撳墠鍚屾椂瀛樺湪澶氫釜浠诲姟锛岃鑱旂郴绠$悊鍛樿繘琛屽鐞嗐")); + } + return requestPOList.get(0).getRequestId(); + } + + private void setEmployeeInfoMap(AddUpDeductionOnlineRequestWrapper requestWrapper) { + // 鍐呴儴鍛樺伐锛堣缁嗕俊鎭級 + List simpleEmployees = getSalaryEmployeeService(user).listAll(UseEmployeeTypeEnum.ORG); + Map simpleEmployeeMap = SalaryEntityUtil.convert2Map(simpleEmployees, DataCollectionEmployee::getEmployeeId); + requestWrapper.setSimpleEmployeeMap(simpleEmployeeMap); + // 鍐呴儴鍛樺伐锛堣韩浠借瘉淇℃伅锛 + List employeeIds = SalaryEntityUtil.properties(requestWrapper.getSalaryArchiveList(), SalaryArchivePO::getEmployeeId, Collectors.toList()); + List simpleUserInfos = getSalaryEmployeeService(user).listByIds(employeeIds); + Map simpleUserInfoMap = SalaryEntityUtil.convert2Map(simpleUserInfos, DataCollectionEmployee::getIdNo); + requestWrapper.setUserInfoIdNoMap(simpleUserInfoMap); + // 澶栭儴鍛樺伐淇℃伅 + List extEmployeePOS = getExtEmpService(user).listAll(); + Map extEmployeePOMap = SalaryEntityUtil.convert2Map(extEmployeePOS, ExtEmpPO::getIdNo, ExtEmpPO::getId); + requestWrapper.setExtEmployeeIdCardMap(extEmployeePOMap); + } + + private void setExistedDataMap(AddUpDeductionOnlineRequestWrapper requestWrapper) { + List taxAgentIds = SalaryEntityUtil.properties(requestWrapper.getSalaryArchiveList(), SalaryArchivePO::getTaxAgentId, Collectors.toList()); + List poList = getAddUpDeductionMapper().listSome(AddUpDeduction.builder().declareMonth(requestWrapper.getRequestPOList().get(0).getTaxYearMonth()).taxAgentIds(taxAgentIds).build()); + requestWrapper.setExistedDataMap(SalaryEntityUtil.convert2Map(poList, e -> e.getTaxAgentId() + "-" + e.getEmployeeId(), AddUpDeduction::getId)); + } + + private AddUpDeductionRequestResultDTO getQuerySpecialAmountFeedback(AddUpDeductionOnlineRequestWrapper requestWrapper) { + for (AddUpDeductionRequestPO requestPO : requestWrapper.getRequestPOList()) { + QuerySpecialAmountFeedbackResponse response = getQuerySpecialAmountFeedbackResponse(requestWrapper.getApiConfig(), requestPO); + // 鏍¢獙璇锋眰缁撴灉 + String responseCode = Optional.ofNullable(response).map(QuerySpecialAmountFeedbackResponse::getHead).map(SzyhResponseHead::getCode).orElse(null); + String msg = Optional.ofNullable(response).map(QuerySpecialAmountFeedbackResponse::getHead).map(SzyhResponseHead::getMsg).orElse(null); + if (SzyhApiConstant.HANDLING_CODE.equals(responseCode)) { + // 濡傛灉鎺ュ彛浠嶅湪澶勭悊涓紝鍒欑户缁疆璇 + return AddUpDeductionRequestResultDTO.builder().finish(false).build(); + } + // 鑾峰彇杩斿洖鐨勪汉鍛樹俊鎭垪琛 + if (!SzyhApiConstant.SUCCESS_CODE.equals(responseCode)) { + log.info("getQuerySpecialAmountFeedback not success error锛歿}", JSON.toJSONString(response)); + throw new SalaryRunTimeException(msg); + } + List feedbacks = Optional.of(response) + .map(QuerySpecialAmountFeedbackResponse::getBody) + .map(QuerySpecialAmountFeedbackResponse.Body::getRyxxlb) + .orElse(new ArrayList<>()); + if (feedbacks.isEmpty()) { + log.info("getQuerySpecialAmountFeedback empty data error锛歿}", JSON.toJSONString(response)); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(175338, "绋庡眬鎺ュ彛閿欒锛屾湭杩斿洖鏈夋晥鏁版嵁")); + } + requestWrapper.getRequestFeedBackMap().put(requestPO.getOuterRequestId(), feedbacks); + requestWrapper.getRequestPoMap().put(requestPO.getOuterRequestId(), requestPO); + } + return AddUpDeductionRequestResultDTO.builder().finish(true).build(); + } + + private void persistFeedbackData(AddUpDeductionOnlineRequestWrapper requestWrapper) { + if (!requestWrapper.getInsertList().isEmpty()) { + List> insertPartition = Lists.partition(requestWrapper.getInsertList(), 100); + insertPartition.forEach(list -> { + list = encryptUtil.encryptList(list, AddUpDeduction.class); + getAddUpDeductionMapper().insertData(list); + }); + } + if (!requestWrapper.getUpdateList().isEmpty()) { + List> updatePartition = Lists.partition(requestWrapper.getUpdateList(), 100); + updatePartition.forEach(list -> { + list = encryptUtil.encryptList(list, AddUpDeduction.class); + getAddUpDeductionMapper().updateData(list); + }); + } + if (!requestWrapper.getFailPOList().isEmpty()) { + List> failPartition = Lists.partition(requestWrapper.getFailPOList(), 100); + failPartition.forEach(list -> getAddUpDeductionRequestFailMapper().batchInsert(list)); + } + } + + private void setBaseInfo2PO(AddUpDeductionOnlineRequestWrapper wrapper, Long employeeId, AddUpDeductionRequestPO requestPO, AddUpDeduction po) { + po.setId(IdGenerator.generate()); + po.setDeclareMonth(wrapper.getRequestPOList().get(0).getTaxYearMonth()); + po.setTaxAgentId(requestPO.getTaxAgentId()); + po.setEmployeeId(employeeId); + po.setCreateTime(new Date()); + po.setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue()); +// po.setModifier(wrapper.getCurrentEmployeeId()); + po.setTenantKey(wrapper.getTenantKey()); + po.setCreator(wrapper.getCurrentEmployeeId()); + } + + public void updateRequestStatus(List requestPOList, Integer oldStatus, Integer newStatus) { + for (AddUpDeductionRequestPO requestPO : requestPOList) { + int i = getAddUpDeductionRequestMapper().updateRequestStatusLockVersion(AddUpDeductionRequestPO.builder() + .requestStatus(newStatus) + .lockVersion(requestPO.getLockVersion() + 1) + .updateTime(new Date()) + .oldStatus(oldStatus) + .id(requestPO.getId()) + .oldLockVersion(requestPO.getLockVersion()) + .build() + ); +// SalaryAssert.isTrue(update, SalaryI18nUtil.getI18nLabel(95828, "鏈嶅姟寮傚父锛岃绋嶅悗閲嶈瘯")); + } + } + + public QuerySpecialAmountFeedbackResponse getQuerySpecialAmountFeedbackResponse(TaxDeclarationApiConfigPO apiConfig, AddUpDeductionRequestPO requestPO) { + String url = apiConfig.getHost() + SzyhApiConstant.GET_QUERY_SPECIAL_AMOUNT_FEEDBACK; + Map params = new HashMap<>(1); + params.put("requestId", requestPO.getOuterRequestId()); + Map header = SingnatureData.initHeader(Collections.emptyMap(), apiConfig.getAppKey(), apiConfig.getAppSecret()); + String res = HttpUtil.getRequest(url, header, params); + log.info("GET_QUERY_SPECIAL_AMOUNT_FEEDBACK res = {}", res); + return JsonUtil.parseObject(res, QuerySpecialAmountFeedbackResponse.class); + } + + @Data + public static class AddUpDeductionOnlineRequestWrapper { + private String tenantKey; + private Long currentEmployeeId; + // 鍗曟璇锋眰瀵瑰簲鐨勫弽棣堟暟鎹甿ap + private Map> requestFeedBackMap; + private Map requestPoMap; + // 鏌ヨ钖祫妗f锛堝畾钖佸緟鍋滆柂銆佸仠钖級 + private List salaryArchiveList; + private Map taxAgentMap; + // 鍛樺伐淇℃伅map(韬唤璇佸彿 -> 鍛樺伐ID) + private Map userInfoIdNoMap; + // 鍛樺伐淇℃伅map(鍛樺伐ID -> 韬唤璇) + private Map userInfoUserIdMap; + // 鍛樺伐璇︾粏淇℃伅map(key = 鍛樺伐ID) + private Map simpleEmployeeMap; + // 鑾峰彇褰撳墠搴撲腑绱闄勫姞鎵i櫎鐨勬暟鎹 + private Map existedDataMap; + // 闇瑕佹柊澧炵殑鏁版嵁 + private List insertList; + // 闇瑕佹洿鏂扮殑鏁版嵁 + private List updateList; + // 澶辫触鏁版嵁锛堝垎椤碉級 + private List failDTOList; + // 澶辫触鏁版嵁锛堟寔涔呭寲锛 + private List failPOList; + // 璇锋眰璇︾粏淇℃伅鍒楄〃 + private List requestPOList; + // 澶栭儴浜哄憳(韬唤璇 -> id) + private Map extEmployeeIdCardMap; + // 澶栭儴浜哄憳(id -> 瀹炰綋) + private Map extEmployeePOMap; + // api閰嶇疆 + private TaxDeclarationApiConfigPO apiConfig; + + public AddUpDeductionOnlineRequestWrapper(List requestPOList, + List salaryArchiveList, + List taxAgents, + Long currentEmployeeId) { + this.requestFeedBackMap = new HashMap<>(); + this.requestPoMap = new HashMap<>(); + this.insertList = new ArrayList<>(); + this.updateList = new ArrayList<>(); + this.failDTOList = new ArrayList<>(); + this.failPOList = new ArrayList<>(); + this.salaryArchiveList = salaryArchiveList; + this.requestPOList = requestPOList; + this.tenantKey = DEFAULT_TENANT_KEY; + this.currentEmployeeId = currentEmployeeId; + this.taxAgentMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgentPO::getId, TaxAgentPO::getName); + } + + public AddUpDeductionRequestFailListDTO buildAddUpDeductionRequestFailListDTO(AddUpDeductionRequestFailPO failPO) { + DataCollectionEmployee userInfo = this.userInfoUserIdMap.get(failPO.getEmployeeId()); + ExtEmpPO extEmployeePO = this.extEmployeePOMap.get(failPO.getEmployeeId()); + DataCollectionEmployee simpleEmployee = this.simpleEmployeeMap.get(failPO.getEmployeeId()); + String departmentName = Optional.ofNullable(simpleEmployee).map(DataCollectionEmployee::getDepartmentName).orElse(""); + + AddUpDeductionRequestFailListDTO listDTO = AddUpDeductionRequestFailListDTO.builder() + .id(failPO.getId().toString()) + .employeeId(failPO.getEmployeeId()) + .employeeType(EmployeeTypeEnum.parseByValue(failPO.getEmployeeType()).toString()) + .employeeName(Optional.ofNullable(simpleEmployee).map(DataCollectionEmployee::getUsername) + .orElse(Optional.ofNullable(extEmployeePO).map(ExtEmpPO::getUsername) + .orElse(""))) + .jobNum(Optional.ofNullable(simpleEmployee).map(DataCollectionEmployee::getWorkcode).orElse("")) + .idNo(Optional.ofNullable(userInfo).map(DataCollectionEmployee::getIdNo) + .orElse(Optional.ofNullable(extEmployeePO).map(ExtEmpPO::getIdNo) + .orElse(""))) + .departmentName(Optional.ofNullable(departmentName).orElse("")) + .failReason(failPO.getReason()) + .taxAgentName(this.taxAgentMap.get(failPO.getTaxAgentId())) + .build(); + Pattern pattern = Pattern.compile("\\[+[\\u4e00-\\u9fa5]*+]+\\|+\\[+[0-9]*+]"); + Matcher matcher = pattern.matcher(Optional.ofNullable(failPO.getReason()).orElse("")); + if (matcher.find()) { + String[] split = failPO.getReason().split("\\|"); + listDTO.setEmployeeName(split[0].substring(split[0].indexOf('[') + 1, split[0].indexOf(']'))); + listDTO.setIdNo(split[1].substring(split[1].indexOf('[') + 1, split[1].indexOf(']'))); + } + return listDTO; + } + } + } diff --git a/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java b/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java index 5a81ad857..9c360d55c 100644 --- a/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java @@ -1,5 +1,6 @@ package com.engine.salary.service.impl; +import com.alibaba.fastjson.JSON; import com.api.browser.bean.SearchConditionGroup; import com.api.browser.bean.SearchConditionItem; import com.api.browser.util.ConditionFactory; @@ -8,33 +9,38 @@ import com.api.formmode.mybatis.util.SqlProxyHandle; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.biz.AddUpSituationBiz; +import com.engine.salary.constant.SzyhApiConstant; import com.engine.salary.encrypt.EncryptUtil; import com.engine.salary.entity.datacollection.AddUpSituation; import com.engine.salary.entity.datacollection.DataCollectionEmployee; +import com.engine.salary.entity.datacollection.bo.DataCollectionBO; import com.engine.salary.entity.datacollection.dto.AddUpSituationDTO; import com.engine.salary.entity.datacollection.dto.AddUpSituationRecordDTO; -import com.engine.salary.entity.datacollection.param.AddUpSituationDeleteParam; -import com.engine.salary.entity.datacollection.param.AddUpSituationImportParam; -import com.engine.salary.entity.datacollection.param.AddUpSituationParam; -import com.engine.salary.entity.datacollection.param.AddUpSituationQueryParam; +import com.engine.salary.entity.datacollection.param.*; +import com.engine.salary.entity.datacollection.po.AddUpDeductionRequestPO; +import com.engine.salary.entity.datacollection.response.GetCompanyIncomesResponse; +import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO; import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO; +import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO; import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO; import com.engine.salary.entity.taxagent.po.TaxAgentPO; +import com.engine.salary.entity.taxagent.po.TaxAgentTaxReturnPO; +import com.engine.salary.entity.taxagent.response.SzyhResponseHead; +import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationApiConfigPO; import com.engine.salary.enums.UserStatusEnum; +import com.engine.salary.enums.employeedeclare.DeclareStatusEnum; +import com.engine.salary.enums.salaryarchive.SalaryArchiveStatusEnum; +import com.engine.salary.enums.taxagent.TaxAgentTaxReturnStatusEnum; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.mapper.datacollection.AddUpSituationMapper; +import com.engine.salary.mapper.employeedeclare.EmployeeDeclareMapper; import com.engine.salary.mapper.sys.SalarySysConfMapper; -import com.engine.salary.service.AddUpDeductionService; -import com.engine.salary.service.AddUpSituationService; -import com.engine.salary.service.SalaryEmployeeService; -import com.engine.salary.service.TaxAgentService; +import com.engine.salary.service.*; import com.engine.salary.sys.entity.po.SalarySysConfPO; import com.engine.salary.sys.entity.vo.OrderRuleVO; import com.engine.salary.sys.service.SalarySysConfService; import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl; -import com.engine.salary.util.SalaryDateUtil; -import com.engine.salary.util.SalaryEntityUtil; -import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.*; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.excel.ExcelComment; import com.engine.salary.util.excel.ExcelParseHelper; @@ -43,8 +49,10 @@ import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.math.NumberUtils; import org.apache.poi.util.IOUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import weaver.file.ImageFileManager; @@ -61,6 +69,7 @@ import java.util.stream.Collectors; import static com.engine.salary.constant.SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY; +@Slf4j public class AddUpSituationServiceImpl extends Service implements AddUpSituationService { private EncryptUtil encryptUtil = new EncryptUtil(); @@ -84,12 +93,28 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation return ServiceUtil.getService(SalarySysConfServiceImpl.class, user); } + private TaxDeclarationApiConfigService getTaxDeclarationApiConfigService(User user) { + return ServiceUtil.getService(TaxDeclarationApiConfigServiceImpl.class, user); + } + + private TaxAgentTaxReturnService getTaxAgentTaxReturnService(User user) { + return ServiceUtil.getService(TaxAgentTaxReturnServiceImpl.class, user); + } + + private SalaryArchiveService getSalaryArchiveService(User user) { + return ServiceUtil.getService(SalaryArchiveServiceImpl.class, user); + } + AddUpSituationBiz biz = new AddUpSituationBiz(); private SalarySysConfMapper getSalarySysConfMapper() { return SqlProxyHandle.getProxy(SalarySysConfMapper.class); } + private EmployeeDeclareMapper getEmployeeDeclareMapper() { + return MapperProxyFactory.getProxy(EmployeeDeclareMapper.class); + } + @Override public Map getSearchCondition() { Map apidatas = new HashMap(); @@ -273,8 +298,8 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation long employeeId = user.getUID(); // excel鏍囬 final List title = Arrays.asList("濮撳悕", "涓◣鎵g即涔夊姟浜", "閮ㄩ棬", "鎵嬫満鍙", "宸ュ彿", "璇佷欢鍙风爜", "鍏ヨ亴鏃ユ湡", "绱鏀跺叆棰", "绱鍑忛櫎璐圭敤", - "绱绀句繚涓汉鍚堣", "绱鍏Н閲戜釜浜哄悎璁", "绱瀛愬コ鏁欒偛", "绱缁х画鏁欒偛", "绱浣忔埧璐锋鍒╂伅", "绱浣忔埧绉熼噾", "绱璧″吇鑰佷汉", - "绱澶х梾鍖荤枟", "绱浼佷笟锛堣亴涓氾級骞撮噾鍙婂叾浠栫鍒", "绱鍏朵粬鎵i櫎", "绱鍏嶇◣鏀跺叆", "绱鍑嗕簣鎵i櫎鐨勬崘璧犻", "绱鍑忓厤绋庨", "绱宸查鎵i缂寸◣棰", "绱濠村辜鍎跨収鎶","绱涓汉鍏昏侀噾"); + "绱绀句繚涓汉鍚堣", "绱鍏Н閲戜釜浜哄悎璁", "绱浼佷笟锛堣亴涓氾級骞撮噾鍙婂叾浠栫鍒", "绱鍏朵粬鎵i櫎", "绱鍏嶇◣鏀跺叆", "绱鍑嗕簣鎵i櫎鐨勬崘璧犻", "绱鍑忓厤绋庨", + "绱宸查鎵i缂寸◣棰", "瀹為檯绱宸查鎵i缂寸◣棰", "涓◣璋冨樊", "绱搴旂撼绋庢墍寰楅"); //鎺掑簭閰嶇疆 OrderRuleVO orderRule = getSalarySysConfService(user).orderRule(); @@ -304,20 +329,15 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation cellList.add(Util.null2String(dto.getAddUpSubtraction())); cellList.add(Util.null2String(dto.getAddUpSocialSecurityTotal())); cellList.add(Util.null2String(dto.getAddUpAccumulationFundTotal())); - cellList.add(Util.null2String(dto.getAddUpChildEducation())); - cellList.add(Util.null2String(dto.getAddUpContinuingEducation())); - cellList.add(Util.null2String(dto.getAddUpHousingLoanInterest())); - cellList.add(Util.null2String(dto.getAddUpHousingRent())); - cellList.add(Util.null2String(dto.getAddUpSupportElderly())); - cellList.add(Util.null2String(dto.getAddUpIllnessMedical())); cellList.add(Util.null2String(dto.getAddUpEnterpriseAndOther())); cellList.add(Util.null2String(dto.getAddUpOtherDeduction())); cellList.add(Util.null2String(dto.getAddUpTaxExemptIncome())); cellList.add(Util.null2String(dto.getAddUpAllowedDonation())); cellList.add(Util.null2String(dto.getAddUpTaxSavings())); cellList.add(Util.null2String(dto.getAddUpAdvanceTax())); - cellList.add(Util.null2String(dto.getAddUpInfantCare())); - cellList.add(Util.null2String(dto.getAddUpPrivatePension())); + cellList.add(Util.null2String(dto.getActualAddUpAdvanceTax())); + cellList.add(Util.null2String(dto.getTaxAdjustment())); + cellList.add(Util.null2String(dto.getAddUpTaxableIncome())); return cellList; }).collect(Collectors.toList())) .orElse(Collections.emptyList()); @@ -338,9 +358,9 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation private List> getExcelRowDetailList(AddUpSituationQueryParam param) { long employeeId = user.getUID(); //excel鏍囬 - List title = Arrays.asList("濮撳悕", "绋庢鎵灞炴湡", "涓◣鎵g即涔夊姟浜", "閮ㄩ棬", "鎵嬫満鍙", "宸ュ彿", "绱鏀跺叆棰", "绱鍑忛櫎璐圭敤", "绱绀句繚涓汉鍚堣", - "绱鍏Н閲戜釜浜哄悎璁", "绱瀛愬コ鏁欒偛", "绱缁х画鏁欒偛", "绱浣忔埧璐锋鍒╂伅", "绱浣忔埧绉熼噾", "绱璧″吇鑰佷汉", "绱澶х梾鍖荤枟", "绱浼佷笟锛堣亴涓氾級骞撮噾鍙婂叾浠栫鍒", - "绱鍏朵粬鎵i櫎", "绱鍏嶇◣鏀跺叆", "绱鍑嗕簣鎵i櫎鐨勬崘璧犻", "绱鍑忓厤绋庨", "绱宸查鎵i缂寸◣棰", "绱濠村辜鍎跨収鎶","绱涓汉鍏昏侀噾"); + List title = Arrays.asList("濮撳悕", "绋庢鎵灞炴湡", "涓◣鎵g即涔夊姟浜", "閮ㄩ棬", "鎵嬫満鍙", "宸ュ彿", "绱鏀跺叆棰", "绱鍑忛櫎璐圭敤", + "绱绀句繚涓汉鍚堣", "绱鍏Н閲戜釜浜哄悎璁", "绱浼佷笟锛堣亴涓氾級骞撮噾鍙婂叾浠栫鍒", "绱鍏朵粬鎵i櫎", "绱鍏嶇◣鏀跺叆", "绱鍑嗕簣鎵i櫎鐨勬崘璧犻", "绱鍑忓厤绋庨", + "绱宸查鎵i缂寸◣棰", "瀹為檯绱宸查鎵i缂寸◣棰", "涓◣璋冨樊", "绱搴旂撼绋庢墍寰楅"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM"); //鏌ヨ璇︾粏淇℃伅 @@ -368,20 +388,15 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation cellList.add(Util.null2String(dto.getAddUpSubtraction())); cellList.add(Util.null2String(dto.getAddUpSocialSecurityTotal())); cellList.add(Util.null2String(dto.getAddUpAccumulationFundTotal())); - cellList.add(Util.null2String(dto.getAddUpChildEducation())); - cellList.add(Util.null2String(dto.getAddUpContinuingEducation())); - cellList.add(Util.null2String(dto.getAddUpHousingLoanInterest())); - cellList.add(Util.null2String(dto.getAddUpHousingRent())); - cellList.add(Util.null2String(dto.getAddUpSupportElderly())); - cellList.add(Util.null2String(dto.getAddUpIllnessMedical())); cellList.add(Util.null2String(dto.getAddUpEnterpriseAndOther())); cellList.add(Util.null2String(dto.getAddUpOtherDeduction())); cellList.add(Util.null2String(dto.getAddUpTaxExemptIncome())); cellList.add(Util.null2String(dto.getAddUpAllowedDonation())); cellList.add(Util.null2String(dto.getAddUpTaxSavings())); cellList.add(Util.null2String(dto.getAddUpAdvanceTax())); - cellList.add(Util.null2String(dto.getAddUpInfantCare())); - cellList.add(Util.null2String(dto.getAddUpPrivatePension())); + cellList.add(Util.null2String(dto.getActualAddUpAdvanceTax())); + cellList.add(Util.null2String(dto.getTaxAdjustment())); + cellList.add(Util.null2String(dto.getAddUpTaxableIncome())); return cellList; }).collect(Collectors.toList())) .orElse(Collections.emptyList()); @@ -445,20 +460,15 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation SalaryI18nUtil.getI18nLabel(86711, "绱鍑忛櫎璐圭敤"), SalaryI18nUtil.getI18nLabel(86710, "绱绀句繚涓汉鍚堣"), SalaryI18nUtil.getI18nLabel(86709, "绱鍏Н閲戜釜浜哄悎璁"), - SalaryI18nUtil.getI18nLabel(86321, "绱瀛愬コ鏁欒偛"), - SalaryI18nUtil.getI18nLabel(86323, "绱缁х画鏁欒偛"), - SalaryI18nUtil.getI18nLabel(86324, "绱浣忔埧璐锋鍒╂伅"), - SalaryI18nUtil.getI18nLabel(86325, "绱浣忔埧绉熼噾"), - SalaryI18nUtil.getI18nLabel(86326, "绱璧″吇鑰佷汉"), - SalaryI18nUtil.getI18nLabel(105142, "绱澶х梾鍖荤枟"), SalaryI18nUtil.getI18nLabel(90567, "绱浼佷笟锛堣亴涓氾級骞撮噾鍙婂叾浠栫鍒"), SalaryI18nUtil.getI18nLabel(93902, "绱鍏朵粬鍏嶇◣鎵i櫎"), SalaryI18nUtil.getI18nLabel(86704, "绱鍏嶇◣鏀跺叆"), SalaryI18nUtil.getI18nLabel(86703, "绱鍑嗕簣鎵i櫎鐨勬崘璧犻"), SalaryI18nUtil.getI18nLabel(105478, "绱鍑忓厤绋庨"), SalaryI18nUtil.getI18nLabel(86702, "绱宸查鎵i缂寸◣棰"), - SalaryI18nUtil.getI18nLabel(86702, "绱濠村辜鍎跨収鎶"), - SalaryI18nUtil.getI18nLabel(86702, "绱涓汉鍏昏侀噾") + SalaryI18nUtil.getI18nLabel(86702, "瀹為檯绱宸查鎵i缂寸◣棰"), + SalaryI18nUtil.getI18nLabel(86702, "涓◣璋冨樊"), + SalaryI18nUtil.getI18nLabel(86702, "绱搴旂撼绋庢墍寰楅") }; // 2.琛ㄥご List headerList = Arrays.asList(header); @@ -496,23 +506,6 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation row.add(Util.null2String(dto.getJobNum())); row.add(Util.null2String(dto.getIdNo())); row.add(Util.null2String(dto.getHiredate())); -// row.add(Util.null2String(dto.getAddUpIncome())); -// row.add(Util.null2String(dto.getAddUpSubtraction())); -// row.add(Util.null2String(dto.getAddUpSocialSecurityTotal())); -// row.add(Util.null2String(dto.getAddUpAccumulationFundTotal())); -// row.add(Util.null2String(dto.getAddUpChildEducation())); -// row.add(Util.null2String(dto.getAddUpContinuingEducation())); -// row.add(Util.null2String(dto.getAddUpHousingLoanInterest())); -// row.add(Util.null2String(dto.getAddUpHousingRent())); -// row.add(Util.null2String(dto.getAddUpSupportElderly())); -// row.add(Util.null2String(dto.getAddUpIllnessMedical())); -// row.add(Util.null2String(dto.getAddUpEnterpriseAndOther())); -// row.add(Util.null2String(dto.getAddUpOtherDeduction())); -// row.add(Util.null2String(dto.getAddUpTaxExemptIncome())); -// row.add(Util.null2String(dto.getAddUpAllowedDonation())); -// row.add(Util.null2String(dto.getAddUpTaxSavings())); -// row.add(Util.null2String(dto.getAddUpAdvanceTax())); -// row.add(Util.null2String(dto.getAddUpInfantCare())); rows.add(row); } // 4.娉ㄩ噴 @@ -532,11 +525,6 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation excelComments.add(new ExcelComment(17, 0, 22, 2, SalaryI18nUtil.getI18nLabel(100344, "杈撳叆鏁板瓧"))); excelComments.add(new ExcelComment(18, 0, 23, 2, SalaryI18nUtil.getI18nLabel(100344, "杈撳叆鏁板瓧"))); excelComments.add(new ExcelComment(19, 0, 24, 2, SalaryI18nUtil.getI18nLabel(100344, "杈撳叆鏁板瓧"))); - excelComments.add(new ExcelComment(20, 0, 25, 2, SalaryI18nUtil.getI18nLabel(100344, "杈撳叆鏁板瓧"))); - excelComments.add(new ExcelComment(21, 0, 26, 2, SalaryI18nUtil.getI18nLabel(100344, "杈撳叆鏁板瓧"))); - excelComments.add(new ExcelComment(22, 0, 27, 2, SalaryI18nUtil.getI18nLabel(100344, "杈撳叆鏁板瓧"))); - excelComments.add(new ExcelComment(23, 0, 28, 2, SalaryI18nUtil.getI18nLabel(100344, "杈撳叆鏁板瓧"))); - excelComments.add(new ExcelComment(24, 0, 29, 2, SalaryI18nUtil.getI18nLabel(100344, "杈撳叆鏁板瓧"))); return ExcelUtil.genWorkbookV2(rows, sheetName, excelComments); } @@ -571,7 +559,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation InputStream fileInputStream = null; try { fileInputStream = ImageFileManager.getInputStreamById(Integer.valueOf(imageId)); - List excelDates = ExcelParseHelper.parse2Map(fileInputStream, AddUpSituationDTO.class, 0, 1, 25, "template.xlsx"); + List excelDates = ExcelParseHelper.parse2Map(fileInputStream, AddUpSituationDTO.class, 0, 1, 20, "template.xlsx"); apidatas.put("preview", excelDates); } finally { IOUtils.closeQuietly(fileInputStream); @@ -609,7 +597,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation // 鑾峰彇宸茬粡鏍哥畻鐨勬暟鎹(鑾峰彇绋庢鎵灞炴湡涓嬩竴涓湀鐨勬暟鎹) YearMonth nextTaxYearMonth = SalaryDateUtil.String2YearMonth(taxYearMonthStr); String nextTaxYearMonthStr = taxYearMonthStr; - if( !Objects.equals(nextTaxYearMonth.getMonthValue(),12) ){ + if (!Objects.equals(nextTaxYearMonth.getMonthValue(), 12)) { nextTaxYearMonth = nextTaxYearMonth.plusMonths(1); nextTaxYearMonthStr = nextTaxYearMonth.format(SalaryDateUtil.MONTH_FORMATTER); } @@ -625,7 +613,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation try { fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(imageId)); - List excelDates = ExcelParseHelper.parse2Map(fileInputStream, AddUpSituationDTO.class, 0, 1, 25, "template.xlsx"); + List excelDates = ExcelParseHelper.parse2Map(fileInputStream, AddUpSituationDTO.class, 0, 1, 20, "template.xlsx"); int total = excelDates.size(); int index = 0; @@ -693,7 +681,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation errorMessageMap.put("message", rowIndex + "鍛樺伐淇℃伅涓嶅瓨鍦ㄦ垨鑰呭瓨鍦ㄥ涓憳宸"); errorData.add(errorMessageMap); errorSum += 1; - }else { + } else { Long employeeId = CollectionUtils.isNotEmpty(employeeSameIds) && employeeSameIds.size() == 1 ? employeeSameIds.get(0).getEmployeeId() : null; po.setEmployeeId(employeeId); } @@ -744,7 +732,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation // } // 鍒ゆ柇鏄惁鏈夋牳绠楄繃 - if (CollectionUtils.isNotEmpty(salaryAcctEmployees) && !Objects.equals(taxYearMonthStr.split("-")[1], "12") ) { + if (CollectionUtils.isNotEmpty(salaryAcctEmployees) && !Objects.equals(taxYearMonthStr.split("-")[1], "12")) { Optional optionalAcctEmp = salaryAcctEmployees.stream().filter(f -> f.getEmployeeId().equals(po.getEmployeeId()) && f.getTaxAgentId().equals(po.getTaxAgentId())).findFirst(); boolean isExist = list.stream().anyMatch(f -> f.getEmployeeId().equals(po.getEmployeeId()) && f.getTaxAgentId().equals(po.getTaxAgentId())); if (optionalAcctEmp.isPresent() && isExist) { @@ -804,6 +792,16 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation po.setAddUpInfantCare(dto.getAddUpInfantCare()); po.setAddUpPrivatePension(dto.getAddUpPrivatePension()); + //瀹為檯绱宸查鎵i缂寸◣棰 + String actualAddUpAdvanceTax = dto.getActualAddUpAdvanceTax(); + po.setActualAddUpAdvanceTax(actualAddUpAdvanceTax); + //涓◣璋冨樊 + String taxAdjustment = dto.getTaxAdjustment(); + po.setTaxAdjustment(taxAdjustment); + //绱搴旂撼绋庢墍寰楅 + String addUpTaxableIncome = dto.getAddUpTaxableIncome(); + po.setAddUpTaxableIncome(addUpTaxableIncome); + if (errorSum == 0) { successCount += 1; // 鍚堟牸鏁版嵁 @@ -846,8 +844,8 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation } /** - * @description 缂栬緫鏁版嵁 * @return void + * @description 缂栬緫鏁版嵁 * @author Harryxzy * @date 2022/10/27 21:32 */ @@ -860,12 +858,12 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation // 鑾峰彇鎵鏈変釜绋庢墸缂翠箟鍔′汉 Collection taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId); AddUpSituation byId = biz.getById(addUpSituationParam.getId()); - if(byId == null){ + if (byId == null) { throw new SalaryRunTimeException("璇ユ暟鎹笉瀛樺湪锛"); } Long taxAgentId = byId.getTaxAgentId(); - boolean canEdit = taxAgentList.stream().anyMatch(t -> Objects.equals(t.getTaxAgentId() , taxAgentId)); - if(!canEdit){ + boolean canEdit = taxAgentList.stream().anyMatch(t -> Objects.equals(t.getTaxAgentId(), taxAgentId)); + if (!canEdit) { //娌℃湁缂栬緫鏉冮檺 throw new SalaryRunTimeException("璇ヤ釜绋庢墸缂翠箟鍔′汉鏃犳潈闄愮紪杈戞鏁版嵁锛"); } @@ -873,14 +871,14 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation // 鑾峰彇宸茬粡鏍哥畻鐨勬暟鎹(鑾峰彇绋庢鎵灞炴湡涓嬩竴涓湀鐨勬暟鎹) YearMonth nextTaxYearMonth = SalaryDateUtil.String2YearMonth(taxYearMonthStr); String nextTaxYearMonthStr = taxYearMonthStr; - if( !Objects.equals(nextTaxYearMonth.getMonthValue(),12) ){ + if (!Objects.equals(nextTaxYearMonth.getMonthValue(), 12)) { nextTaxYearMonth = nextTaxYearMonth.plusMonths(1); nextTaxYearMonthStr = nextTaxYearMonth.format(SalaryDateUtil.MONTH_FORMATTER); } List salaryAcctEmployees = getAddUpDeductionService(user).getAccountedEmployeeDataByTaxYearMonth(nextTaxYearMonthStr); // 鍒ゆ柇鏄惁鏈夋牳绠楄繃 - if (CollectionUtils.isNotEmpty(salaryAcctEmployees) && !Objects.equals(taxYearMonthStr.split("-")[1], "12")) { + if (CollectionUtils.isNotEmpty(salaryAcctEmployees) && !Objects.equals(taxYearMonthStr.split("-")[1], "12")) { Optional optionalAcctEmp = salaryAcctEmployees.stream().filter(f -> f.getEmployeeId().equals(addUpSituationParam.getEmployeeId()) && f.getTaxAgentId().equals(addUpSituationParam.getTaxAgentId())).findFirst(); if (optionalAcctEmp.isPresent()) { throw new SalaryRunTimeException("璇ュ勾鏈堣繖鏉℃暟鎹凡缁忔牳绠楄繃,涓嶅彲杩涜缂栬緫锛"); @@ -897,14 +895,17 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation .addUpTaxSavings(addUpSituationParam.getAddUpTaxSavings()).addUpAdvanceTax(addUpSituationParam.getAddUpAdvanceTax()) .addUpInfantCare(addUpSituationParam.getAddUpInfantCare()) .addUpPrivatePension(addUpSituationParam.getAddUpPrivatePension()) + .actualAddUpAdvanceTax(addUpSituationParam.getActualAddUpAdvanceTax()) + .taxAdjustment(addUpSituationParam.getTaxAdjustment()) + .addUpTaxableIncome(addUpSituationParam.getAddUpTaxableIncome()) .build(); updateList.add(build); biz.batchUpdate(updateList); } /** - * @description 鏂板缓鏁版嵁 * @return void + * @description 鏂板缓鏁版嵁 * @author Harryxzy * @date 2022/10/27 22:04 */ @@ -947,8 +948,8 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation //绛涢夊鍏ヤ汉鍛樹俊鎭彲浠ュ湪浜哄姏璧勬簮姹犱腑鍖归厤鍒扮殑浜哄憳淇℃伅 - boolean employeeSameId = employees.stream().anyMatch(e -> Objects.equals(e.getEmployeeId() , addUpSituationParam.getEmployeeId())); - if(!employeeSameId){ + boolean employeeSameId = employees.stream().anyMatch(e -> Objects.equals(e.getEmployeeId(), addUpSituationParam.getEmployeeId())); + if (!employeeSameId) { throw new SalaryRunTimeException("鍛樺伐淇℃伅涓嶅瓨鍦"); } po.setEmployeeId(addUpSituationParam.getEmployeeId()); @@ -967,7 +968,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation } } - // fixme 鍒嗘潈鍒ゆ柇锛岃嫢鍛樺伐绂昏亴鍚庯紝涓嶅湪鎵g即涔夊姟浜鸿寖鍥村唴锛屼細鏈夊紓甯 + // fixme 鍒嗘潈鍒ゆ柇锛岃嫢鍛樺伐绂昏亴鍚庯紝涓嶅湪鎵g即涔夊姟浜鸿寖鍥村唴锛屼細鏈夊紓甯 // if (openDevolution) { // Optional optionalTaxAgentEmp = taxAgentEmployees.stream().filter(f -> f.getEmployeeId().equals(po.getEmployeeId())).findFirst(); // if (!optionalTaxAgentEmp.isPresent()) { @@ -1033,6 +1034,14 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation po.setAddUpTaxSavings(addUpSituationParam.getAddUpTaxSavings()); po.setAddUpInfantCare(addUpSituationParam.getAddUpInfantCare()); po.setAddUpPrivatePension(addUpSituationParam.getAddUpPrivatePension()); + //瀹為檯绱宸查鎵i缂寸◣棰 + po.setActualAddUpAdvanceTax(addUpSituationParam.getActualAddUpAdvanceTax()); + //涓◣璋冨樊 + po.setTaxAdjustment(addUpSituationParam.getTaxAdjustment()); + //绱搴旂撼绋庢墍寰楅 + po.setAddUpTaxableIncome(addUpSituationParam.getAddUpTaxableIncome()); + + insertList.add(po); //鍏ュ簱 @@ -1055,15 +1064,15 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation List salaryAcctEmployees = getAddUpDeductionService(user).getAccountedEmployeeData(format); // 鍒ゆ柇鏄惁鏈夋牳绠楄繃 List deleteList = new ArrayList<>(); - for(int i=0; i first = taxAgentList.stream().filter(m -> Objects.equals(m.getTaxAgentId() , byId.getTaxAgentId())).findFirst(); - if(!first.isPresent()){ + Optional first = taxAgentList.stream().filter(m -> Objects.equals(m.getTaxAgentId(), byId.getTaxAgentId())).findFirst(); + if (!first.isPresent()) { throw new SalaryRunTimeException("涓◣鎵g即涔夊姟浜轰笉瀛樺湪鎴栦笉鍦ㄦ潈闄愯寖鍥村唴"); } // 鍒ゆ柇鐢ㄦ埛鏄惁瀛樺湪 @@ -1089,23 +1098,23 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation AddUpSituationBiz biz = new AddUpSituationBiz(); Date declareMonthDate = new Date(); try { - declareMonthDate = (sdf.parse(declareMonthStr+"-01")); - }catch (Exception e){ + declareMonthDate = (sdf.parse(declareMonthStr + "-01")); + } catch (Exception e) { throw new SalaryRunTimeException("鏃ユ湡寮傚父"); } AddUpSituation queryParam = null; - if(deleteParam.getTaxAgentId() != null && !deleteParam.getTaxAgentId().isEmpty()){ + if (deleteParam.getTaxAgentId() != null && !deleteParam.getTaxAgentId().isEmpty()) { // 璁剧疆浜嗕釜绋庢墸缂翠箟鍔′汉 Long taxAgentId = SalaryEntityUtil.string2Long(deleteParam.getTaxAgentId()); - boolean canDelete = taxAgentIds.stream().anyMatch(t -> Objects.equals(t , taxAgentId)); - if(!canDelete){ + boolean canDelete = taxAgentIds.stream().anyMatch(t -> Objects.equals(t, taxAgentId)); + if (!canDelete) { throw new SalaryRunTimeException("涓◣鎵g即涔夊姟浜轰笉瀛樺湪鎴栦笉鍦ㄦ潈闄愯寖鍥村唴!"); } ArrayList tai = new ArrayList<>(); tai.add(taxAgentId); - queryParam = AddUpSituation.builder().taxYearMonth(declareMonthDate).taxAgentIds(tai).build(); - }else { + queryParam = AddUpSituation.builder().taxYearMonth(declareMonthDate).taxAgentIds(tai).build(); + } else { queryParam = AddUpSituation.builder().taxYearMonth(declareMonthDate).taxAgentIds(taxAgentIds).build(); } @@ -1115,7 +1124,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation String format = salaryMonthDate.plusMonths(1).atStartOfDay().format(DateTimeFormatter.ofPattern("yyyy-MM")); // 鑾峰彇宸茬粡鏍哥畻鐨勬暟鎹 List employees = getAddUpDeductionService(user).getAccountedEmployeeData(format); - for(AddUpSituation item : list){ + for (AddUpSituation item : list) { if (CollectionUtils.isNotEmpty(employees)) { Optional optionalAcctEmp = employees.stream().filter(f -> f.getEmployeeId().equals(item.getEmployeeId()) && f.getTaxAgentId().equals(item.getTaxAgentId())).findFirst(); if (optionalAcctEmp.isPresent()) { @@ -1137,11 +1146,11 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation ids.add(addUpSituationParam.getId()); AddUpSituationQueryParam build = AddUpSituationQueryParam.builder().ids(ids).build(); List list = biz.recordList(build); - if(list == null || list.size()==0){ + if (list == null || list.size() == 0) { throw new SalaryRunTimeException("璇ユ暟鎹笉瀛樺湪锛"); } String taxAgentName = list.get(0).getTaxAgentName(); - if(!taxAgentNames.contains(taxAgentName)){ + if (!taxAgentNames.contains(taxAgentName)) { throw new SalaryRunTimeException("鎮ㄦ棤鏉冩煡鐪嬭鏁版嵁!"); } return list.get(0); @@ -1150,10 +1159,183 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation @Override public void batchSave(List list) { if (CollectionUtils.isNotEmpty(list)) { - list = encryptUtil.encryptList(list,AddUpSituation.class); + list = encryptUtil.encryptList(list, AddUpSituation.class); List> partition = Lists.partition(list, 50); partition.forEach(getAddUpSituationMapper()::insertData); } } + + @Override + public Map onlineRequest(AddUpDeductionMonthTaxAgentParam param) { + SalaryAssert.notNull(param.getDeclareMonth(), SalaryI18nUtil.getI18nLabel(100586, "绋庢鎵灞炴湡蹇呬紶")); + // 鑾峰彇鎺ュ彛閰嶇疆 + TaxDeclarationApiConfigPO apiConfig = getTaxDeclarationApiConfigService(user).getConfig(true); + // 鑾峰彇鍖呰绫 + AddUpDeductionServiceImpl.AddUpDeductionOnlineRequestWrapper requestWrapper = getAddUpDeductionOnlineRequestWrapper(null, apiConfig); + // 鑾峰彇鎶ョ◣淇℃伅 + List taxReturnPOList = getTaxAgentTaxReturnService(user).getByTaxAgentIds(requestWrapper.getTaxAgentMap().keySet()); + List failReturnPOList = taxReturnPOList.stream().filter(e -> !TaxAgentTaxReturnStatusEnum.SUCCESS.getValue().equals(e.getCheckStatus())).collect(Collectors.toList()); + SalaryAssert.isFalse(taxReturnPOList.size() == failReturnPOList.size(), SalaryI18nUtil.getI18nLabel(183781, "浼佷笟鏈氳繃楠岃瘉锛屾殏鏃舵棤娉曡幏鍙栫疮璁′笓椤归檮鍔犳墸闄ゆ暟鎹紝璇峰厛鍦ㄣ愪釜绋庢墸缂翠箟鍔′汉銆戣彍鍗曢獙璇佷紒涓氭姤绋庝俊鎭")); + Map result = new HashMap<>(1); + if (!failReturnPOList.isEmpty()) { + String failTaxAgentNames = failReturnPOList.stream().map(e -> requestWrapper.getTaxAgentMap().get(e.getTaxAgentId())).collect(Collectors.joining("銆")); + result.put("msg", String.format(SalaryI18nUtil.getI18nLabel(183782, "%s鏈氳繃鐧昏楠岃瘉锛屾棤娉曞湪绾胯幏鍙栨暟鎹"), failTaxAgentNames)); + } + // 鑾峰彇鎶ラ佹垚鍔熺殑浜哄憳鍚嶅崟 + Map> taxAgentEmpDeclareMap = getEmpDeclareMap(requestWrapper.getTaxAgentMap().keySet(), param.getDeclareMonth()); + // 寮濮嬭姹傛帴鍙h幏鍙栨暟鎹 + getQuerySpecialAmountBodies(param, requestWrapper, taxAgentEmpDeclareMap, taxReturnPOList); + return result; + } + + private void getQuerySpecialAmountBodies(AddUpDeductionMonthTaxAgentParam param, + AddUpDeductionServiceImpl.AddUpDeductionOnlineRequestWrapper requestWrapper, + Map> taxAgentEmployeeDeclareMap, + List taxReturnPOList) { + List updateList = new ArrayList<>(); + List insertList = new ArrayList<>(); + for (TaxAgentTaxReturnPO returnPO : taxReturnPOList) { + if (!TaxAgentTaxReturnStatusEnum.SUCCESS.getValue().equals(returnPO.getCheckStatus())) { + continue; + } + // 鍙戣捣璇锋眰 + String taxAgentName = requestWrapper.getTaxAgentMap().get(returnPO.getTaxAgentId()); + List declarePOList = taxAgentEmployeeDeclareMap.getOrDefault(returnPO.getTaxAgentId(), new ArrayList<>()); + if (declarePOList.isEmpty()) { + log.info("璇ヤ富浣撲笅娌℃湁鎶ラ佹垚鍔熺殑浜哄憳锛屼富浣撳悕绉帮細{}", taxAgentName); + continue; + } + List poList = getAddUpSituationMapper().listSome((AddUpSituation.builder().taxYearMonth(param.getDeclareMonth()).taxAgentId(returnPO.getTaxAgentId()).build())); + encryptUtil.decryptList(poList,AddUpSituation.class); + Map poMap = SalaryEntityUtil.convert2Map(poList, e -> e.getTaxAgentId() + "-" + e.getEmployeeId()); + + // 鍐呴儴鍛樺伐锛堣韩浠借瘉淇℃伅锛 + List employeeIds = SalaryEntityUtil.properties(requestWrapper.getSalaryArchiveList(), SalaryArchivePO::getEmployeeId, Collectors.toList()); + List simpleUserInfos = getSalaryEmployeeService(user).listByIds(employeeIds); + Map simpleUserInfoMap = SalaryEntityUtil.convert2Map(simpleUserInfos, DataCollectionEmployee::getIdNo); + + for (int i = 1; true; i++) { + GetCompanyIncomesResponse queryResponse = getCompanyIncomes(returnPO, taxAgentName, param, requestWrapper.getApiConfig(), i); + // 鏍¢獙璇锋眰缁撴灉 + String responseCode = Optional.ofNullable(queryResponse) + .map(GetCompanyIncomesResponse::getHead) + .map(SzyhResponseHead::getCode) + .orElse(null); + List details = Optional.ofNullable(queryResponse) + .map(GetCompanyIncomesResponse::getBody) + .map(GetCompanyIncomesResponse.Body::getSfmx) + .orElse(null); + if (!SzyhApiConstant.SUCCESS_CODE.equals(responseCode)) { + log.info("getCompanyIncomes error锛歿}", JSON.toJSONString(queryResponse)); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(95828, "鏈嶅姟寮傚父锛岃绋嶅悗閲嶈瘯")); + } + if (CollectionUtils.isEmpty(details)) { + break; + } + Date now = new Date(); + for (GetCompanyIncomesResponse.Detail detail : details) { + DataCollectionEmployee simpleUserInfo = simpleUserInfoMap.get(detail.getZjhm()); + Long employeeId = Optional.ofNullable(simpleUserInfo) + .map(DataCollectionEmployee::getEmployeeId) + .orElse(0L); + if (poMap.containsKey(returnPO.getTaxAgentId() + "-" + employeeId)) { + AddUpSituation po = poMap.get(returnPO.getTaxAgentId() + "-" + employeeId); + po.setUpdateTime(now); + po.setActualAddUpAdvanceTax(detail.getKjse()); + po.setTaxAdjustment(SalaryEntityUtil.string2BigDecimalDefault0(detail.getKjse()).subtract(SalaryEntityUtil.string2BigDecimalDefault0(po.getAddUpAdvanceTax())).toString()); + updateList.add(po); + } else { + AddUpSituation po = new AddUpSituation(); +// po.setId(IdGenerator.generate()); + po.setCreateTime(now); + po.setUpdateTime(now); + po.setCreator(requestWrapper.getCurrentEmployeeId()); + po.setDeleteType(NumberUtils.INTEGER_ZERO); + po.setTenantKey(requestWrapper.getTenantKey()); + po.setYear(param.getDeclareMonth().getYear()); + po.setTaxYearMonth(param.getDeclareMonth()); + po.setEmployeeType(0); + po.setTaxAgentId(returnPO.getTaxAgentId()); + po.setEmployeeId(employeeId); + po.setAddUpIncome("0"); + po.setAddUpSubtraction("0"); + po.setAddUpSocialSecurityTotal("0"); + po.setAddUpAccumulationFundTotal("0"); + po.setAddUpEnterpriseAndOther("0"); + po.setAddUpOtherDeduction("0"); + po.setAddUpTaxExemptIncome("0"); + po.setAddUpAllowedDonation("0"); + po.setAddUpTaxSavings("0"); + po.setAddUpAdvanceTax("0"); + po.setAddUpTaxableIncome("0"); + po.setActualAddUpAdvanceTax(detail.getKjse()); + po.setTaxAdjustment(detail.getKjse()); + insertList.add(po); + } + } + } + } + if (!insertList.isEmpty()) { + List> insertPartition = Lists.partition(insertList, 50); + insertPartition.forEach(list -> { + list = encryptUtil.encryptList(list, AddUpSituation.class); + getAddUpSituationMapper().insertData(list); + }); + } + if (!updateList.isEmpty()) { + List> updatePartition = Lists.partition(updateList, 50); + updatePartition.forEach(list -> { + list = encryptUtil.encryptList(list, AddUpSituation.class); + getAddUpSituationMapper().updateData(list); + }); + } + } + + private GetCompanyIncomesResponse getCompanyIncomes(TaxAgentTaxReturnPO returnPO, + String taxAgentName, + AddUpDeductionMonthTaxAgentParam param, + TaxDeclarationApiConfigPO apiConfig, + Integer pageNo) { + String url = apiConfig.getHost() + SzyhApiConstant.GET_COMPANY_INCOMES; + Map requestParam = DataCollectionBO.getApiBaseQueryParams(returnPO, taxAgentName, SalaryDateUtil.getFormatYYYYMM(param.getDeclareMonth())); + requestParam.put("pageSize", 1000); + requestParam.put("pageNo", pageNo); + requestParam.put("reportType", 1); + String reqJson = JsonUtil.toJsonString(requestParam); + log.info("getCompanyIncomes params --- \n{}\n", reqJson); + Map params = new HashMap<>(1); + Map header = SingnatureData.initHeader(params, apiConfig.getAppKey(), apiConfig.getAppSecret()); + // 寮濮嬭姹 + String res = HttpUtil.doPost(url, header, reqJson, HttpUtil.JSON_TYPE); + log.info("getCompanyIncomes res --- {}", res); + return JsonUtil.parseObject(res, GetCompanyIncomesResponse.class); + } + + private AddUpDeductionServiceImpl.AddUpDeductionOnlineRequestWrapper getAddUpDeductionOnlineRequestWrapper(List requestPOList, TaxDeclarationApiConfigPO apiConfig) { + boolean isOpenDevolution = getTaxAgentService(user).isOpenDevolution(); + boolean isChief = getTaxAgentService(user).isChief((long) user.getUID()); + List taxAgents = !isOpenDevolution || isChief ? getTaxAgentService(user).listAll() : (List) getTaxAgentService(user).listAllTaxAgentsAsAdmin((long) user.getUID()); + Set taxAgentIdSet = SalaryEntityUtil.properties(taxAgents, TaxAgentPO::getId); + // 鑾峰彇钖祫妗f + List salaryArchiveList = getSalaryArchiveService(user).listByRunStatus(Arrays.asList( + SalaryArchiveStatusEnum.FIXED.getValue(), + SalaryArchiveStatusEnum.SUSPEND.getValue(), + SalaryArchiveStatusEnum.STOP_FROM_SUSPEND.getValue(), + SalaryArchiveStatusEnum.STOP_FROM_PENDING.getValue())); + salaryArchiveList = salaryArchiveList.stream().filter(e -> taxAgentIdSet.contains(e.getTaxAgentId())).collect(Collectors.toList()); + AddUpDeductionServiceImpl.AddUpDeductionOnlineRequestWrapper requestWrapper = new AddUpDeductionServiceImpl.AddUpDeductionOnlineRequestWrapper(requestPOList, salaryArchiveList, taxAgents, (long) user.getUID()); + requestWrapper.setApiConfig(apiConfig); + return requestWrapper; + } + + private Map> getEmpDeclareMap(Collection taxAgentIds, Date declareMonth) { + List employeeDeclarePOS = getEmployeeDeclarePOList(taxAgentIds, declareMonth); + SalaryAssert.notEmpty(employeeDeclarePOS, SalaryI18nUtil.getI18nLabel(183783, "鏆傛棤浜哄憳鎶ラ佺姸鎬佷负姝e父鐨勬暟鎹紝璇峰厛鎶ラ佸啀鑾峰彇寰鏈熺疮璁℃暟鎹")); + return employeeDeclarePOS.stream().collect(Collectors.groupingBy(EmployeeDeclarePO::getTaxAgentId)); + } + + private List getEmployeeDeclarePOList(Collection taxAgentIds, Date declareMonth) { + return getEmployeeDeclareMapper().listSome(EmployeeDeclarePO.builder().declareStatus(DeclareStatusEnum.DECLARE_SUCCESS.getValue()).taxCycle(declareMonth).taxAgentIds(taxAgentIds).build()); + } } diff --git a/src/com/engine/salary/service/impl/SalaryAcctCalculateServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctCalculateServiceImpl.java index 018702a7a..fc29dabff 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctCalculateServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctCalculateServiceImpl.java @@ -183,82 +183,80 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc formulaVarValues.addAll(empInfo); Map formulaVarValueMap = SalaryEntityUtil.convert2Map(formulaVarValues, CalculateFormulaVarBO.FormulaVarValue::getFieldId, CalculateFormulaVarBO.FormulaVarValue::getFieldValue); // 鎸夌収璁$畻濂界殑浼樺厛绾ц绠楄柂璧勯」鐩殑鍊 - for (List salaryItemIds : salaryAcctCalculateBO.getSalaryItemIdWithPriorityList()) { + for (Long salaryItemId : salaryAcctCalculateBO.getSalaryItemIdWithPriorityList()) { // 鍚屼竴杩愮畻浼樺厛绾т笅鐨勮柂璧勯」鐩愪釜鐙珛杩愮畻 - for (Long salaryItemId : salaryItemIds) { - String resultValue; - SalaryItemPO salaryItemPO = salaryItemMap.get(salaryItemId); - ExpressFormula expressFormula; - if (salarySobBackItemMap.containsKey(salaryItemId)) { - // 濡傛灉钖祫璐﹀鐨勫洖绠楅」鐩腑閲嶆柊瀹氫箟浜嗗洖绠楅」鐩叕寮忥紝鍒欎娇鐢ㄨ柂璧勮处濂椾笅鐨勫叕寮 - SalarySobBackItemPO salarySobBackItemPO = salarySobBackItemMap.get(salaryItemId); - expressFormula = expressFormulaMap.get(salarySobBackItemPO.getFormulaId()); - } else if (salaryItemIdKeySalarySobItemPOMap.containsKey(salaryItemId)) { - // 濡傛灉钖祫璐﹀涓嬮噸鏂板畾涔変簡钖祫椤圭洰鐨勫叕寮忥紝鍒欎娇鐢ㄨ柂璧勮处濂椾笅鐨勫叕寮忥紝鍚﹀垯浣跨敤钖祫椤圭洰鏈韩鐨勫叕寮 - SalarySobItemPO salarySobItemPO = salaryItemIdKeySalarySobItemPOMap.get(salaryItemId); - expressFormula = expressFormulaMap.get(salarySobItemPO.getFormulaId()); - } else { - expressFormula = expressFormulaMap.get(salaryItemPO.getFormulaId()); + String resultValue; + SalaryItemPO salaryItemPO = salaryItemMap.get(salaryItemId); + ExpressFormula expressFormula; + if (salarySobBackItemMap.containsKey(salaryItemId)) { + // 濡傛灉钖祫璐﹀鐨勫洖绠楅」鐩腑閲嶆柊瀹氫箟浜嗗洖绠楅」鐩叕寮忥紝鍒欎娇鐢ㄨ柂璧勮处濂椾笅鐨勫叕寮 + SalarySobBackItemPO salarySobBackItemPO = salarySobBackItemMap.get(salaryItemId); + expressFormula = expressFormulaMap.get(salarySobBackItemPO.getFormulaId()); + } else if (salaryItemIdKeySalarySobItemPOMap.containsKey(salaryItemId)) { + // 濡傛灉钖祫璐﹀涓嬮噸鏂板畾涔変簡钖祫椤圭洰鐨勫叕寮忥紝鍒欎娇鐢ㄨ柂璧勮处濂椾笅鐨勫叕寮忥紝鍚﹀垯浣跨敤钖祫椤圭洰鏈韩鐨勫叕寮 + SalarySobItemPO salarySobItemPO = salaryItemIdKeySalarySobItemPOMap.get(salaryItemId); + expressFormula = expressFormulaMap.get(salarySobItemPO.getFormulaId()); + } else { + expressFormula = expressFormulaMap.get(salaryItemPO.getFormulaId()); + } + if (Objects.nonNull(expressFormula)) { + // 杩愯鍏紡 + ExcelResult result = runExpressFormula(expressFormula, formulaVarValueMap, simpleEmployee); + resultValue = Utils.null2String(result.getData()); + //鍏紡寮傚父淇℃伅 + if (!result.isStatus()) { + String username = empInfo.stream().filter(emp -> StringUtils.equals("employeeInfo_username", emp.getFieldId())).findFirst().map(CalculateFormulaVarBO.FormulaVarValue::getFieldValue).orElse(""); + String errorMsg = String.format("%s鐨%s鏍哥畻寮傚父锛屽師鍥狅細%s \r\n", username, salaryItemPO.getName(), result.getErrorMsg()); + noticeMsg.append(errorMsg); } - if (Objects.nonNull(expressFormula)) { - // 杩愯鍏紡 - ExcelResult result = runExpressFormula(expressFormula, formulaVarValueMap, simpleEmployee); - resultValue = Utils.null2String(result.getData()); - //鍏紡寮傚父淇℃伅 - if (!result.isStatus()) { - String username = empInfo.stream().filter(emp -> StringUtils.equals("employeeInfo_username", emp.getFieldId())).findFirst().map(CalculateFormulaVarBO.FormulaVarValue::getFieldValue).orElse(""); - String errorMsg = String.format("%s鐨%s鏍哥畻寮傚父锛屽師鍥狅細%s \r\n", username, salaryItemPO.getName(), result.getErrorMsg()); - noticeMsg.append(errorMsg); - } - //鎻愰啋杩愯瓒呮椂 - if (StringUtils.isNotBlank(formulaRunOvertimeThreshold) && result.getRunTime() > Long.parseLong(formulaRunOvertimeThreshold)) { - String username = empInfo.stream().filter(emp -> StringUtils.equals("employeeInfo_username", emp.getFieldId())).findFirst().map(CalculateFormulaVarBO.FormulaVarValue::getFieldValue).orElse(""); - String errorMsg = String.format("%s鐨%s鏍哥畻瓒呮椂锛岃楁椂锛%s姣 \r\n", username, salaryItemPO.getName(), result.getRunTime()); - noticeMsg.append(errorMsg); - } - } else { - // 澶勭悊鍙栧肩被鍨嬩负鈥滆緭鍏/瀵煎叆鈥濈殑钖祫椤圭洰 - String key = SalaryFormulaReferenceEnum.SALARY_ITEM.getValue() + SalaryFormulaFieldConstant.FIELD_ID_SEPARATOR + salaryItemPO.getCode(); - resultValue = formulaVarValueMap.getOrDefault(key, StringUtils.EMPTY); + //鎻愰啋杩愯瓒呮椂 + if (StringUtils.isNotBlank(formulaRunOvertimeThreshold) && result.getRunTime() > Long.parseLong(formulaRunOvertimeThreshold)) { + String username = empInfo.stream().filter(emp -> StringUtils.equals("employeeInfo_username", emp.getFieldId())).findFirst().map(CalculateFormulaVarBO.FormulaVarValue::getFieldValue).orElse(""); + String errorMsg = String.format("%s鐨%s鏍哥畻瓒呮椂锛岃楁椂锛%s姣 \r\n", username, salaryItemPO.getName(), result.getRunTime()); + noticeMsg.append(errorMsg); } - // 澶勭悊钖祫妗f - if (Objects.equals(salaryItemPO.getUseInEmployeeSalary(), NumberUtils.INTEGER_ONE)) { - String key = SalaryFormulaReferenceEnum.SALARY_ARCHIVES.getValue() + SalaryFormulaFieldConstant.FIELD_ID_SEPARATOR + salaryItemPO.getCode(); - resultValue = formulaVarValueMap.getOrDefault(key, StringUtils.EMPTY); - } - // 澶勭悊鍚堝苟璁$◣ - resultValue = handleConsolidatedTax(resultValue, salaryItemPO, salaryAcctCalculateBO, otherSalaryAcctEmployeePOMap.get(salaryAcctEmployeePO.getEmployeeId() + "_" + salaryAcctEmployeePO.getTaxAgentId()), otherSalaryAcctResultPOMap.get(salaryAcctEmployeePO.getEmployeeId() + "_" + salaryAcctEmployeePO.getTaxAgentId())); - - // 澶勭悊灏忔暟鐐 - resultValue = SalaryAcctFormulaBO.roundResultValue(resultValue, salaryItemPO, salarySobBackItems, salarySobBackItemMap, salaryItemIdKeySalarySobItemPOMap); - //鏄惁閿佸畾 - if (lockSalaryItemIds.contains(salaryItemId) && salaryAcctLockResultPOS.get(salaryItemId + "_" + salaryAcctEmployeePOId) != null) { - resultValue = salaryAcctLockResultPOS.get(salaryItemId + "_" + salaryAcctEmployeePOId).getResultValue(); - } - // 灏嗗凡缁忚绠楄繃鐨勮柂璧勯」鐩殑鍊艰浆鎹㈡垚鍏紡鍙橀噺鐨勫兼坊鍔犲埌闆嗗悎涓 + } else { + // 澶勭悊鍙栧肩被鍨嬩负鈥滆緭鍏/瀵煎叆鈥濈殑钖祫椤圭洰 String key = SalaryFormulaReferenceEnum.SALARY_ITEM.getValue() + SalaryFormulaFieldConstant.FIELD_ID_SEPARATOR + salaryItemPO.getCode(); - formulaVarValueMap.put(key, resultValue); - // 鍊间繚瀛樿柂璧勮处濂椾笅鐨勮柂璧勯」鐩殑鏍哥畻缁撴灉 - if (salaryItemIdKeySalarySobItemPOMap.containsKey(salaryItemId) || salarySobBackItemIds.contains(salaryItemId)) { - // 杞崲鎴愯柂璧勬牳绠楃粨鏋減o - SalaryAcctResultTempPO salaryAcctResultTempPO = new SalaryAcctResultTempPO() - .setSalaryAcctRecordId(salaryAcctEmployeePO.getSalaryAcctRecordId()) - .setSalaryAcctEmpId(salaryAcctEmployeePOId) - .setEmployeeId(salaryAcctEmployeePO.getEmployeeId()) - .setTaxAgentId(salaryAcctEmployeePO.getTaxAgentId()) - .setSalarySobId(salaryAcctEmployeePO.getSalarySobId()) - .setSalaryItemId(salaryItemPO.getId()) - .setResultValue(resultValue) - .setOriginResultValue(salaryAcctResultPOMap.get(salaryAcctEmployeePO.getEmployeeId() + "-" + salaryAcctEmployeePO.getTaxAgentId() + "-" + salaryItemId) == null - ? StringUtils.EMPTY : salaryAcctResultPOMap.get(salaryAcctEmployeePO.getEmployeeId() + "-" + salaryAcctEmployeePO.getTaxAgentId() + "-" + salaryItemId)) - .setCalculateKey(salaryAcctCalculateBO.getCalculateKey()) - .setCreator((long) user.getUID()) - .setCreateTime(now) - .setUpdateTime(now) - .setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) - .setDeleteType(0); - salaryAcctResultTempPOS.add(salaryAcctResultTempPO); - } + resultValue = formulaVarValueMap.getOrDefault(key, StringUtils.EMPTY); + } + // 澶勭悊钖祫妗f + if (Objects.equals(salaryItemPO.getUseInEmployeeSalary(), NumberUtils.INTEGER_ONE)) { + String key = SalaryFormulaReferenceEnum.SALARY_ARCHIVES.getValue() + SalaryFormulaFieldConstant.FIELD_ID_SEPARATOR + salaryItemPO.getCode(); + resultValue = formulaVarValueMap.getOrDefault(key, StringUtils.EMPTY); + } + // 澶勭悊鍚堝苟璁$◣ + resultValue = handleConsolidatedTax(resultValue, salaryItemPO, salaryAcctCalculateBO, otherSalaryAcctEmployeePOMap.get(salaryAcctEmployeePO.getEmployeeId() + "_" + salaryAcctEmployeePO.getTaxAgentId()), otherSalaryAcctResultPOMap.get(salaryAcctEmployeePO.getEmployeeId() + "_" + salaryAcctEmployeePO.getTaxAgentId())); + + // 澶勭悊灏忔暟鐐 + resultValue = SalaryAcctFormulaBO.roundResultValue(resultValue, salaryItemPO, salarySobBackItems, salarySobBackItemMap, salaryItemIdKeySalarySobItemPOMap); + //鏄惁閿佸畾 + if (lockSalaryItemIds.contains(salaryItemId) && salaryAcctLockResultPOS.get(salaryItemId + "_" + salaryAcctEmployeePOId) != null) { + resultValue = salaryAcctLockResultPOS.get(salaryItemId + "_" + salaryAcctEmployeePOId).getResultValue(); + } + // 灏嗗凡缁忚绠楄繃鐨勮柂璧勯」鐩殑鍊艰浆鎹㈡垚鍏紡鍙橀噺鐨勫兼坊鍔犲埌闆嗗悎涓 + String key = SalaryFormulaReferenceEnum.SALARY_ITEM.getValue() + SalaryFormulaFieldConstant.FIELD_ID_SEPARATOR + salaryItemPO.getCode(); + formulaVarValueMap.put(key, resultValue); + // 鍊间繚瀛樿柂璧勮处濂椾笅鐨勮柂璧勯」鐩殑鏍哥畻缁撴灉 + if (salaryItemIdKeySalarySobItemPOMap.containsKey(salaryItemId) || salarySobBackItemIds.contains(salaryItemId)) { + // 杞崲鎴愯柂璧勬牳绠楃粨鏋減o + SalaryAcctResultTempPO salaryAcctResultTempPO = new SalaryAcctResultTempPO() + .setSalaryAcctRecordId(salaryAcctEmployeePO.getSalaryAcctRecordId()) + .setSalaryAcctEmpId(salaryAcctEmployeePOId) + .setEmployeeId(salaryAcctEmployeePO.getEmployeeId()) + .setTaxAgentId(salaryAcctEmployeePO.getTaxAgentId()) + .setSalarySobId(salaryAcctEmployeePO.getSalarySobId()) + .setSalaryItemId(salaryItemPO.getId()) + .setResultValue(resultValue) + .setOriginResultValue(salaryAcctResultPOMap.get(salaryAcctEmployeePO.getEmployeeId() + "-" + salaryAcctEmployeePO.getTaxAgentId() + "-" + salaryItemId) == null + ? StringUtils.EMPTY : salaryAcctResultPOMap.get(salaryAcctEmployeePO.getEmployeeId() + "-" + salaryAcctEmployeePO.getTaxAgentId() + "-" + salaryItemId)) + .setCalculateKey(salaryAcctCalculateBO.getCalculateKey()) + .setCreator((long) user.getUID()) + .setCreateTime(now) + .setUpdateTime(now) + .setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) + .setDeleteType(0); + salaryAcctResultTempPOS.add(salaryAcctResultTempPO); } } } diff --git a/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java index 9b4b123f6..94dd92579 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java @@ -4,6 +4,7 @@ import com.api.formmode.mybatis.util.SqlProxyHandle; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.common.LocalDateRange; +import com.engine.salary.common.YearMonthRange; import com.engine.salary.entity.salaryBill.po.SalarySendPO; import com.engine.salary.entity.salaryacct.bo.SalaryAcctRecordBO; import com.engine.salary.entity.salaryacct.param.SalaryAcctRecordQueryParam; @@ -14,6 +15,8 @@ import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO; import com.engine.salary.entity.salaryacct.po.SalaryAcctTaxAgentPO; import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO; import com.engine.salary.entity.salarysob.po.SalarySobPO; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; +import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO; import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum; import com.engine.salary.enums.salarysob.IncomeCategoryEnum; import com.engine.salary.exception.SalaryRunTimeException; @@ -32,6 +35,8 @@ import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; import com.engine.salary.util.valid.ValidUtil; +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; @@ -78,6 +83,10 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe return ServiceUtil.getService(SalarySysConfServiceImpl.class, user); } + private SalaryAcctTaxAgentService getSalaryAcctTaxAgentService(User user) { + return ServiceUtil.getService(SalaryAcctTaxAgentServiceImpl.class, user); + } + // private SalaryCheckResultService salaryCheckResultService; // // private SalaryCheckResultDetailService salaryCheckResultDetailService; @@ -271,9 +280,11 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe public Long save(SalaryAcctRecordSaveParam saveParam) { ValidUtil.doValidator(saveParam); //妫鏌 - checkBeforeSave(saveParam); +// checkBeforeSave(saveParam); + SalarySobPO salarySobPO = getSalarySobService(user).getById(saveParam.getSalarySobId()); + // 鏌ヨ绋庢鎵灞炴湡 SalarySobCycleDTO salarySobCycleDTO = getSalarySobService(user).getSalarySobCycle(saveParam.getSalarySobId(), saveParam.getSalaryMonth()); // 钖祫鎵灞炴湀鎵鍦ㄥ勾鐨勬棩鏈熻寖鍥达紙绗竴澶╋綖鏈鍚庝竴澶╋級 @@ -293,12 +304,20 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe // 杞崲鎴恜o SalaryAcctRecordPO salaryAcctRecordPO = SalaryAcctRecordBO.convert2PO(saveParam, salarySobCycleDTO, (int) acctTimes, (long) user.getUID()); + + //妫鏌 + // 妫鏌ユ槸鍚﹁兘澶熸柊寤烘牳绠 + SalaryAcctTaxAgentPO build = SalaryAcctTaxAgentPO.builder().incomeCategory(salarySobPO.getIncomeCategory()).taxAgentId(salarySobPO.getTaxAgentId()).taxCycle(salaryAcctRecordPO.getTaxCycle()).build(); + List salaryAcctTaxAgents = new ArrayList<>(); + salaryAcctTaxAgents.add(build); + checkBeforeSave(salaryAcctRecordPO, salaryAcctTaxAgents); + // 淇濆瓨钖祫鏍哥畻璁板綍 getSalaryAcctRecordMapper().insertIgnoreNull(salaryAcctRecordPO); // 鍒濆鍖栬柂璧勬牳绠椾汉鍛 getSalaryAcctEmployeeService(user).initBySalaryAcctRecord(salaryAcctRecordPO); // 璁板綍鏃ュ織 -// String targetName = getLogTargetNameById(salaryAcctRecordPO.getId(), tenantKey); +// String targetName = getLogTargetNameById(salaryAcctRecordPO.getId()); // LoggerContext loggerContext = new LoggerContext<>(); // loggerContext.setTargetId("" + salaryAcctRecordPO.getId()); // loggerContext.setTargetName(targetName); @@ -438,6 +457,136 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe } + + /** + * 淇濆瓨涔嬪墠妫鏌ヤ竴涓嬫槸鍚﹀彲浠ユ柊寤烘牳绠 + * + * @param salaryAcctTaxAgents + */ + @Override + public void checkBeforeSave(SalaryAcctRecordPO salaryAcctRecord, List salaryAcctTaxAgents) { + // 鏌ヨ钖祫璐﹀ + SalarySobPO salarySobPO = getSalarySobService(user).getById(salaryAcctRecord.getSalarySobId()); + IncomeCategoryEnum incomeCategoryEnums = IncomeCategoryEnum.parseByValue(salarySobPO.getIncomeCategory()); + if (incomeCategoryEnums == IncomeCategoryEnum.ONETIME_ANNUAL_BONUS) { + // 濡傛灉褰撳墠鏄崟鐙牳绠楀勾缁堝锛屾棤闇鏍¢獙鍏朵粬鎵寰楅」鐩殑钖祫鏍哥畻璁板綍 + checkBeforeSaveAnnual(salaryAcctTaxAgents); + } else { + checkBeforeSaveCommon(salaryAcctTaxAgents); + } + } + + private void checkBeforeSaveAnnual(List salaryAcctTaxAgents) { + salaryAcctTaxAgents = salaryAcctTaxAgents.stream() + .filter(e -> Objects.equals(e.getIncomeCategory(), IncomeCategoryEnum.ONETIME_ANNUAL_BONUS.getValue())) + .collect(Collectors.toList()); + if (CollectionUtils.isEmpty(salaryAcctTaxAgents)) { + return; + } + // 鏌ヨ鏈钖祫鏍哥畻璁板綍鐨勭◣娆炬墍灞炴湡鎵鍦ㄥ勾搴︾殑钖祫鏍哥畻璁板綍 + Set sameYearSet = Sets.newHashSet(); + List otherSalaryAcctTaxAgents = Lists.newArrayList(); + for (SalaryAcctTaxAgentPO salaryAcctTaxAgent : salaryAcctTaxAgents) { + Date taxCycle = salaryAcctTaxAgent.getTaxCycle(); + if (!sameYearSet.contains(taxCycle.getYear())) { + sameYearSet.add(taxCycle.getYear()); + // 绋庢鎵灞炴湡鎵鍦ㄥ勾搴︾殑1鏈堬綖12鏈 + YearMonthRange taxCycleRange = new YearMonthRange() + .setStartMonth(SalaryDateUtil.toDateStartOfMonth(SalaryDateUtil.localDate2YearMonth(taxCycle).withMonth(1))) + .setEndMonth(SalaryDateUtil.toDateStartOfMonth(SalaryDateUtil.localDate2YearMonth(taxCycle).withMonth(12))); + // 绋庢鎵灞炴湡鎵鍦ㄥ勾搴︽墍鏈夌殑钖祫鏍哥畻璁板綍 + otherSalaryAcctTaxAgents.addAll(getSalaryAcctTaxAgentService(user).listByTaxCycleRange(taxCycleRange)); + } + } + // 鎺掗櫎鎺夋墍寰楅」鐩笉鏄叏骞翠竴娆℃у閲戞敹鍏ョ殑钖祫鏍哥畻璁板綍 + otherSalaryAcctTaxAgents = otherSalaryAcctTaxAgents.stream() + .filter(e -> Objects.equals(e.getIncomeCategory(), IncomeCategoryEnum.ONETIME_ANNUAL_BONUS.getValue())) + .collect(Collectors.toList()); + // 鍏ㄥ勾涓娆℃у閲戞敹鍏ヤ竴骞村唴鍙兘鐢虫姤涓娆★紝鎵浠ョ◣娆炬墍灞炴湡蹇呴』鐩稿悓 + for (SalaryAcctTaxAgentPO salaryAcctTaxAgent : salaryAcctTaxAgents) { + SalaryAcctTaxAgentPO diffTaxCycleSalaryAcctTaxAgent = otherSalaryAcctTaxAgents.stream() + .filter(e -> Objects.equals(salaryAcctTaxAgent.getTaxAgentId(), e.getTaxAgentId()) + && !Objects.equals(salaryAcctTaxAgent.getTaxCycle(), e.getTaxCycle())) + .findAny() + .orElse(null); + if (diffTaxCycleSalaryAcctTaxAgent != null) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(160502, "鍏ㄥ勾涓娆℃у閲戞敹鍏ヤ竴骞村唴鍙兘鐢虫姤涓娆★紝鎵浠ョ◣娆炬墍灞炴湡蹇呴』鐩稿悓")); + } + } + } + + private void checkBeforeSaveCommon(List salaryAcctTaxAgents) { + // 鎺掗櫎鎺夋墍寰楅」鐩负鍏ㄥ勾涓娆℃у閲戞敹鍏ョ殑钖祫鏍哥畻璁板綍 + salaryAcctTaxAgents = salaryAcctTaxAgents.stream() + .filter(e -> !Objects.equals(e.getIncomeCategory(), IncomeCategoryEnum.ONETIME_ANNUAL_BONUS.getValue())) + .collect(Collectors.toList()); + Set sameYearSet = Sets.newHashSet(); + List sameYearTaxDeclarations = Lists.newArrayList(); + List sameYearSalaryAcctTaxAgents = Lists.newArrayList(); + for (SalaryAcctTaxAgentPO salaryAcctTaxAgent : salaryAcctTaxAgents) { + Date taxCycle = salaryAcctTaxAgent.getTaxCycle(); + if (!sameYearSet.contains(taxCycle.getYear())) { + sameYearSet.add(taxCycle.getYear()); + // 绋庢鎵灞炴湡鎵鍦ㄥ勾搴︾殑1鏈堬綖12鏈 + YearMonthRange taxCycleRange = new YearMonthRange() + .setStartMonth(SalaryDateUtil.toDateStartOfMonth(SalaryDateUtil.localDate2YearMonth(taxCycle).withMonth(1))) + .setEndMonth(SalaryDateUtil.toDateStartOfMonth(SalaryDateUtil.localDate2YearMonth(taxCycle).withMonth(12))); + // 绋庢鎵灞炴湡鎵鍦ㄥ勾搴︽墍鏈夌殑涓◣鐢虫姤琛 + sameYearTaxDeclarations.addAll(getTaxDeclarationService(user).listByTaxCycleRange(taxCycleRange)); + // 绋庢鎵灞炴湡鎵鍦ㄥ勾搴︽墍鏈夌殑钖祫鏍哥畻璁板綍 + sameYearSalaryAcctTaxAgents.addAll(getSalaryAcctTaxAgentService(user).listByTaxCycleRange(taxCycleRange)); + } + } + // 鎺掗櫎鎺夋墍寰楅」鐩负鍏ㄥ勾涓娆℃у閲戞敹鍏ョ殑涓◣鐢虫姤琛ㄥ拰钖祫鏍哥畻璁板綍 + sameYearTaxDeclarations = sameYearTaxDeclarations.stream() + .filter(e -> !Objects.equals(e.getIncomeCategory(), IncomeCategoryEnum.ONETIME_ANNUAL_BONUS.getValue())) + .collect(Collectors.toList()); + sameYearSalaryAcctTaxAgents = sameYearSalaryAcctTaxAgents.stream() + .filter(e -> !Objects.equals(e.getIncomeCategory(), IncomeCategoryEnum.ONETIME_ANNUAL_BONUS.getValue())) + .collect(Collectors.toList()); + + // 鏌ヨ涓◣鎵g即涔夊姟浜 + Set taxAgentIds = SalaryEntityUtil.properties(salaryAcctTaxAgents, SalaryAcctTaxAgentPO::getTaxAgentId); + List taxAgents = getTaxAgentService(user).listByIds(taxAgentIds); + Map taxAgentMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgentPO::getId, TaxAgentPO::getName); + + Set declareTaxAgents = SalaryEntityUtil.properties(sameYearTaxDeclarations, e -> e.getTaxAgentId() + "-" + e.getTaxCycle()); + Map> sameYearSalaryAcctTaxAgentMap = SalaryEntityUtil + .group2Map(sameYearSalaryAcctTaxAgents, SalaryAcctTaxAgentPO::getTaxAgentId); + for (SalaryAcctTaxAgentPO salaryAcctTaxAgent : salaryAcctTaxAgents) { + List salaryAcctTaxAgentList = sameYearSalaryAcctTaxAgentMap.getOrDefault(salaryAcctTaxAgent.getTaxAgentId(), Collections.emptyList()) + .stream() + .filter(e -> !Objects.equals(salaryAcctTaxAgent.getSalaryAcctRecordId(), e.getSalaryAcctRecordId())) + .collect(Collectors.toList()); + if (CollectionUtils.isEmpty(salaryAcctTaxAgentList)) { + continue; + } + // 濡傛灉鏌愪釜鏈堬紙绋庢鎵灞炴湡锛夎繕鏈敵鎶ワ紝涓嶅彲浠ユ柊寤轰箣鍚庢湀浠界殑钖祫鏍哥畻 + SalaryAcctTaxAgentPO notDeclareSalaryAcctTaxAgent = salaryAcctTaxAgentList.stream() + .filter(e -> salaryAcctTaxAgent.getTaxCycle().compareTo(e.getTaxCycle()) > 0 + && !declareTaxAgents.contains(e.getTaxAgentId() + "-" + e.getTaxCycle())) + .findAny() + .orElse(null); + if (Objects.nonNull(notDeclareSalaryAcctTaxAgent)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(160504, "涓◣鎵g即涔夊姟浜恒寋0}銆嶇殑绋庢鎵灞炴湡銆寋1}銆嶇殑涓◣杩樻湭鐢虫姤锛岃鍏堢敵鎶ュ悗鍐嶆潵鏂板缓绋庢鎵灞炴湡銆寋2}銆嶇殑钖祫鏍哥畻") + .replace("{0}", taxAgentMap.get(notDeclareSalaryAcctTaxAgent.getTaxAgentId())) + .replace("{1}", SalaryDateUtil.getFormatYYYYMM(notDeclareSalaryAcctTaxAgent.getTaxCycle())) + .replace("{2}", SalaryDateUtil.getFormatYYYYMM(salaryAcctTaxAgent.getTaxCycle()))); + } + // 濡傛灉鏌愪釜鏈堬紙绋庢鎵灞炴湡锛夊凡缁忔牳绠椾簡锛屼笉鍙互鏂板缓涔嬪墠鏈堜唤鐨勮柂璧勬牳绠 + SalaryAcctTaxAgentPO calculatedSalaryAcctTaxAgent = salaryAcctTaxAgentList.stream() + .filter(e -> salaryAcctTaxAgent.getTaxCycle().compareTo(e.getTaxCycle()) < 0) + .findAny() + .orElse(null); + if (Objects.nonNull(calculatedSalaryAcctTaxAgent)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(160506, "涓◣鎵g即涔夊姟浜恒寋0}銆嶅凡缁忓瓨鍦ㄨ柂璧勬墍灞炴湀銆寋1}銆嶇殑钖祫鏍哥畻璁板綍浜嗭紝鏃犳硶鏂板缓钖祫鎵灞炴湀銆寋2}銆嶇殑钖祫鏍哥畻") + .replace("{0}", taxAgentMap.get(calculatedSalaryAcctTaxAgent.getTaxAgentId())) + .replace("{1}", SalaryDateUtil.getFormatYYYYMM(calculatedSalaryAcctTaxAgent.getSalaryMonth())) + .replace("{2}", SalaryDateUtil.getFormatYYYYMM(salaryAcctTaxAgent.getSalaryMonth()))); + } + } + } + private List listByCreateDate(LocalDateRange taxCycleRebootYearRange, Set salarySobIds) { return getSalaryAcctRecordMapper().listByCreateDate(taxCycleRebootYearRange, salarySobIds); } @@ -594,7 +743,7 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe // salaryAcctRecordPO.setUpdateTime(new Date()); // getSalaryAcctRecordMapper().updateIgnoreNull(salaryAcctRecordPO); // 璁板綍鏃ュ織 -// String targetName = getLogTargetNameById(salaryAcctRecordPO.getId(), tenantKey); +// String targetName = getLogTargetNameById(salaryAcctRecordPO.getId()); // LoggerContext loggerContext = new LoggerContext<>(); // loggerContext.setTargetId("" + salaryAcctRecordPO.getId()); // loggerContext.setTargetName(targetName); diff --git a/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java index 717cfc917..2c732564f 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java @@ -17,6 +17,7 @@ import com.engine.salary.entity.salaryacct.dto.SalaryAcctResultListColumnDTO; import com.engine.salary.entity.salaryacct.param.*; import com.engine.salary.entity.salaryacct.po.*; import com.engine.salary.entity.salaryformula.ExpressFormula; +import com.engine.salary.entity.salaryformula.po.FormulaVar; import com.engine.salary.entity.salaryitem.po.SalaryItemPO; import com.engine.salary.entity.salarysob.dto.*; import com.engine.salary.entity.salarysob.po.*; @@ -26,6 +27,7 @@ import com.engine.salary.enums.SalaryValueTypeEnum; import com.engine.salary.enums.salaryaccounting.LockStatusEnum; import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum; import com.engine.salary.enums.salaryaccounting.SalaryAcctResultDataSourceEnum; +import com.engine.salary.enums.salaryformula.SalaryFormulaReferenceEnum; import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum; import com.engine.salary.enums.salarysob.IncomeCategoryEnum; import com.engine.salary.exception.SalaryRunTimeException; @@ -54,6 +56,8 @@ import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; +import org.jetbrains.annotations.NotNull; +import org.springframework.beans.BeanUtils; import org.springframework.jdbc.datasource.DataSourceTransactionManager; import weaver.hrm.User; @@ -62,8 +66,11 @@ import java.util.*; import java.util.concurrent.BlockingDeque; import java.util.concurrent.CountDownLatch; import java.util.concurrent.LinkedBlockingDeque; +import java.util.regex.Matcher; import java.util.stream.Collectors; +import static com.engine.salary.constant.SalaryFormulaFieldConstant.SALARY_PATTERN; + /** * 钖祫鏍哥畻缁撴灉 *

Copyright: Copyright (c) 2022

@@ -331,7 +338,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe List salarySobItemPOS = getSalarySobItemService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId()); Map salaryItemIdKeySalarySobItemPOMap = SalaryEntityUtil.convert2Map(salarySobItemPOS, SalarySobItemPO::getSalaryItemId); Set salaryItemIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getSalaryItemId); - if(Objects.equals(salaryAcctRecordPO.getBackCalcStatus(), NumberUtils.INTEGER_ONE)){ + if (Objects.equals(salaryAcctRecordPO.getBackCalcStatus(), NumberUtils.INTEGER_ONE)) { // 鏄洖绠楋紝鑾峰彇鍥炵畻椤 List salarySobBackItemPOS = getSalarySobBackItemService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId()); salaryItemIds.addAll(salarySobBackItemPOS.stream().map(SalarySobBackItemPO::getSalaryItemId).collect(Collectors.toList())); @@ -339,7 +346,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe List salaryItemPOS = getSalaryItemService(user).listByIds(salaryItemIds); // 鏌ヨ钖祫鏍哥畻缁撴灉 - List salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId,Collectors.toList()); + List salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId, Collectors.toList()); List salaryAcctResultPOS = listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds); Map map = new HashMap<>(); @@ -396,7 +403,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe } List salaryItemPOS = getSalaryItemService(user).listByIds(salaryItemIds); // 鏌ヨ钖祫鏍哥畻缁撴灉 - List salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId,Collectors.toList()); + List salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId, Collectors.toList()); List salaryAcctResultPOS = listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds); // 鏌ヨ浜哄憳淇℃伅 List employeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getEmployeeId, Collectors.toList()); @@ -477,7 +484,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe salaryAcctEmployeePOS = getSalaryAcctEmployeeService(user).listByRecordIdsAndEmpIdAndTaxAgentId(salaryAcctRecordIds, salaryAcctEmployeePO.getEmployeeId(), salaryAcctEmployeePO.getTaxAgentId()); } // 鏌ヨ钖祫鏍哥畻浜哄憳鐨勮柂璧勬牳绠楃粨鏋 - List salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId,Collectors.toList()); + List salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId, Collectors.toList()); List salaryAcctResultPOS = listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds); // 鏌ヨ钖祫鏍哥畻浜哄憳鎵鏈夊悎骞惰绋庣殑钖祫鏍哥畻璁板綍鎵鐢ㄧ殑璐﹀ Set salarySobIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getSalarySobId); @@ -555,13 +562,13 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe // 淇濆瓨鍙傛暟杞崲鎴愯柂璧勬牳绠楃粨鏋減o List salaryAcctResultPOS = SalaryAcctResultBO.convert2PO(salaryAcctResultPOSOld, saveParam, salaryAcctEmployeePO, (long) user.getUID()); SalarySysConfPO autoLock = getSalarySysConfService(user).getOneByCode(SalarySysConstant.EDIT_IMPORT_AUTO_LOCK); - if(autoLock != null && StringUtils.equals(autoLock.getConfValue(),"1")){ + if (autoLock != null && StringUtils.equals(autoLock.getConfValue(), "1")) { // 瀵规瘮鏍哥畻缁撴灉鎻愬彇淇敼浜嗗摢浜涜柂璧勯」鐩 Set needLockItems = new HashSet<>(); Map oldResutMap = SalaryEntityUtil.convert2Map(salaryAcctResultPOSOld, SalaryAcctResultPO::getSalaryItemId); salaryAcctResultPOS.stream().forEach(PO -> { String oldValue = Optional.ofNullable(oldResutMap.get(PO.getSalaryItemId())).map(SalaryAcctResultPO::getResultValue).orElse(""); - if(!StringUtils.equals(oldValue,PO.getResultValue())){ + if (!StringUtils.equals(oldValue, PO.getResultValue())) { needLockItems.add(PO.getSalaryItemId()); } }); @@ -601,7 +608,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe // 瀛樺偍钖祫鏍哥畻缁撴灉鏁版嵁鏉ユ簮鏃ュ織 salaryAcctResultPOS = getSalaryAcctRecordService(user).listBySalaryAcctEmpId(saveParam.getSalaryAcctEmpId()); - saveSalaryAcctResultLog(salaryAcctResultPOSOld,salaryAcctResultPOS); + saveSalaryAcctResultLog(salaryAcctResultPOSOld, salaryAcctResultPOS); // 鏌ヨ鎿嶄綔鏃ュ織鐨則argetName // String targetName = getSalaryAcctRecordService(user).getLogTargetNameById(salaryAcctEmployeePO.getSalaryAcctRecordId()); @@ -623,6 +630,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe /** * 瀛樺偍钖祫鏍哥畻缁撴灉鏁版嵁鏉ユ簮鏃ュ織 + * * @param salaryAcctResultPOSOld * @param salaryAcctResultPOS */ @@ -631,11 +639,11 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe List editItems = new ArrayList<>(); Map oldResutMap = SalaryEntityUtil.convert2Map(salaryAcctResultPOSOld, SalaryAcctResultPO::getSalaryItemId); salaryAcctResultPOS.stream().forEach(PO -> { - if(oldResutMap.get(PO.getSalaryItemId()) == null){ + if (oldResutMap.get(PO.getSalaryItemId()) == null) { editItems.add(PO); - }else{ + } else { String oldValue = oldResutMap.get(PO.getSalaryItemId()).getResultValue(); - if(!StringUtils.equals(oldValue,PO.getResultValue())){ + if (!StringUtils.equals(oldValue, PO.getResultValue())) { editItems.add(PO); } } @@ -731,9 +739,11 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe formulaIds.addAll(SalaryEntityUtil.properties(salarySobBackItems, SalarySobBackItemPO::getFormulaId)); List expressFormulas = getSalaryFormulaService(user).listExpressFormula(formulaIds); // 鏈杩愮畻鐨勫洖绠楄柂璧勯」鐩墍娑夊強鐨勫彉閲 - Set issuedFieldIds = new HashSet<>(); + Set issuedFieldIds = getIssuedFieldIds(salarySobBackItems); // 9銆佽绠楄柂璧勯」鐩殑杩愮畻浼樺厛绾 - List> salarySobItemsWithPriority = SalaryAcctCalculatePriorityBO.calculatePriority(salarySobItemPOS, salaryItemPOS, expressFormulas, salarySobBackItems, issuedFieldIds); +// List> salarySobItemsWithPriority = SalaryAcctCalculatePriorityBO.calculatePriority(salarySobItemPOS, salaryItemPOS, expressFormulas, salarySobBackItems, issuedFieldIds); + List salarySobItemsWithPriority = sortItems(salarySobItemPOS, salarySobBackItems, salaryItemPOS, expressFormulas); + // 10銆佹牴鎹甶d鏌ヨ鍏朵粬鍚堝苟璁$◣鐨勮柂璧勬牳绠楄褰 List otherSalaryAcctRecordPOS = getSalaryAcctRecordService(user).listById4OtherConsolidatedTax(salaryAcctRecordPO.getId()); // 11銆佹煡璇㈡湰娆℃牳绠椾汉鍛 @@ -819,8 +829,8 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe List salaryAcctEmployeeIds = salaryAcctEmployeePOS.stream().map(SalaryAcctEmployeePO::getId).collect(Collectors.toList()); exceptItemIds.addAll(lockSalaryItemIds); exceptItemIds.addAll(salaryItemPOS.stream().filter(PO -> Objects.equals(PO.getValueType(), NumberUtils.INTEGER_ONE) && - Objects.equals(PO.getUseInEmployeeSalary(),0)) - .map(SalaryItemPO::getId).collect(Collectors.toList()) ); + Objects.equals(PO.getUseInEmployeeSalary(), 0)) + .map(SalaryItemPO::getId).collect(Collectors.toList())); getSalaryAcctResultLogService(user).deleteBySalaryAcctEmpIdExceptItemIds(salaryAcctEmployeeIds, exceptItemIds); } }.start(); @@ -843,6 +853,46 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe } } + @NotNull + private List sortItems(List salarySobItemPOS, List salarySobBackItems, List salaryItemPOS, List expressFormulas) { + + List temp = salarySobBackItems.stream() + .map(e -> { + SalarySobItemPO salarySobItem = new SalarySobItemPO(); + BeanUtils.copyProperties(e, salarySobItem); + return salarySobItem; + }).collect(Collectors.toList()); + salarySobItemPOS.addAll(temp); + + SalaryCalcItemGraph salaryCalcItemGraph = new SalaryCalcItemGraph(salarySobItemPOS, salaryItemPOS, expressFormulas); + List salaryCalcItems = salaryCalcItemGraph.sort(); + return SalaryEntityUtil.properties(salaryCalcItems, SalaryCalcItem::getSalaryItemId, Collectors.toList()); + } + + /** + * 鑾峰彇鍥炵畻鍙橀噺 + * + * @param salarySobBackItems + * @return + */ + @NotNull + private Set getIssuedFieldIds(List salarySobBackItems) { + Set issuedFieldIds; + Set issuedFormulaIds = SalaryEntityUtil.properties(salarySobBackItems, SalarySobBackItemPO::getFormulaId); + List expressFormulas1 = getSalaryFormulaService(user).listExpressFormula(issuedFormulaIds); + List issuedFormulaVars = new ArrayList<>(); + expressFormulas1.forEach(f -> issuedFormulaVars.addAll(f.getParameters())); + issuedFieldIds = issuedFormulaVars.stream() + .map(FormulaVar::getFieldId) + .filter(StringUtils::isNotBlank) + .filter(v -> v.startsWith(SalaryFormulaReferenceEnum.ISSUED.getValue() + "_")) + .map(SALARY_PATTERN::matcher) + .filter(Matcher::find) + .map(m -> m.group(2)) + .collect(Collectors.toSet()); + return issuedFieldIds; + } + /** * 澶勭悊钖祫鏍哥畻涓存椂瀛樺偍琛ㄤ腑鐨勬暟鎹 * @@ -940,9 +990,9 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe // } Set salaryItemIds; - if(CollectionUtils.isNotEmpty(updateParam.getSalaryItemIds())){ + if (CollectionUtils.isNotEmpty(updateParam.getSalaryItemIds())) { salaryItemIds = updateParam.getSalaryItemIds(); - }else{ + } else { salaryItemIds = Collections.singleton(updateParam.getSalaryItemId()); } if (updateParam.getLockStatus() == LockStatusEnum.LOCK) { @@ -981,10 +1031,10 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe @Override public List listByAcctEmployeeIdsAndSalaryItemIds(List salaryAcctEmployeeIds, Collection salaryItemIds) { - if(CollectionUtils.isEmpty(salaryAcctEmployeeIds)){ + if (CollectionUtils.isEmpty(salaryAcctEmployeeIds)) { return Collections.emptyList(); } - List> partition = Lists.partition((List)salaryAcctEmployeeIds, 200); + List> partition = Lists.partition((List) salaryAcctEmployeeIds, 200); List result = new ArrayList<>(); partition.forEach(empIds -> { SalaryAcctResultPO build = SalaryAcctResultPO.builder().salaryAcctEmpIds(empIds).salaryItemIds(salaryItemIds).build(); @@ -1007,10 +1057,10 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe @Override public List listAcctEmpIdByAcctEmpId(List salaryAcctEmployeeIds) { - if(CollectionUtils.isEmpty(salaryAcctEmployeeIds)){ + if (CollectionUtils.isEmpty(salaryAcctEmployeeIds)) { return Collections.emptyList(); } - List> partition = Lists.partition((List)salaryAcctEmployeeIds, 1000); + List> partition = Lists.partition((List) salaryAcctEmployeeIds, 1000); List result = new ArrayList<>(); partition.forEach(empIds -> { result.addAll(getSalaryAcctResultMapper().getAcctEmpIsExist(empIds)); @@ -1047,15 +1097,15 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe public Boolean checkAuth(Long salaryAcctRecordId) { // 鑾峰彇璇ユ牳绠楄褰曠殑涓◣鎵g即涔夊姟 SalaryAcctRecordPO recordPO = getSalaryAcctRecordService(user).getById(salaryAcctRecordId); - if(Objects.isNull(recordPO)) { + if (Objects.isNull(recordPO)) { return false; } SalarySobPO salarySobPO = getSalarySobService(user).getById(recordPO.getSalarySobId()); Long taxAgentId = salarySobPO.getTaxAgentId(); List adminTaxAgentList = getTaxAgentAdminService(user).listByEmployeeId(Long.valueOf(user.getUID())); Optional canOperate = adminTaxAgentList.stream().filter(po -> NumberUtils.compare(taxAgentId, po.getTaxAgentId()) == 0).findFirst(); - if(!canOperate.isPresent()){ - return false; + if (!canOperate.isPresent()) { + return false; } return true; } diff --git a/src/com/engine/salary/service/impl/SalaryAcctTaxAgentServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctTaxAgentServiceImpl.java index 49acd5b52..8bd4fe4f1 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctTaxAgentServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctTaxAgentServiceImpl.java @@ -1,65 +1,45 @@ -//package com.engine.salary.service.impl; -// -//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -//import com.baomidou.mybatisplus.core.toolkit.Wrappers; -//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.entity.salaryacct.po.SalaryAcctTaxAgentPO; -//import com.engine.salary.service.SalaryAcctTaxAgentService; -//import com.google.common.collect.Lists; -//import com.google.common.collect.Sets; -//import com.weaver.common.distribution.genid.IdGenerator; -//import com.weaver.common.hr.util.Util; -//import com.weaver.hrm.salary.common.YearMonthRange; -//import com.weaver.hrm.salary.dao.SalaryAcctTaxAgentMapper; -//import com.weaver.hrm.salary.entity.salaryacct.po.SalaryAcctEmployeePO; -//import com.weaver.hrm.salary.enums.sicategory.DeleteTypeEnum; -//import org.apache.commons.collections4.CollectionUtils; -//import org.springframework.transaction.annotation.Transactional; -// -//import java.time.LocalDateTime; -//import java.util.*; -// -///** -// * @description: -// * @author: xiajun -// * @modified By: xiajun -// * @date: 2022/7/29 9:45 -// * @version:v1.0 -// */ -//public class SalaryAcctTaxAgentServiceImpl extends Service implements SalaryAcctTaxAgentService { -// -// private SalaryAcctTaxAgentMapper salaryAcctTaxAgentMapper; -// +package com.engine.salary.service.impl; + +import com.engine.core.impl.Service; +import com.engine.salary.common.YearMonthRange; +import com.engine.salary.entity.salaryacct.po.SalaryAcctTaxAgentPO; +import com.engine.salary.mapper.salaryacct.SalaryAcctTaxAgentMapper; +import com.engine.salary.service.SalaryAcctTaxAgentService; +import com.engine.salary.util.db.MapperProxyFactory; +import org.apache.commons.collections4.CollectionUtils; + +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Objects; + +public class SalaryAcctTaxAgentServiceImpl extends Service implements SalaryAcctTaxAgentService { + + private SalaryAcctTaxAgentMapper getSalaryAcctTaxAgentMapper() { + return MapperProxyFactory.getProxy(SalaryAcctTaxAgentMapper.class); + } + @Override + public List listBySalaryAcctRecordIds(Collection salaryAcctRecordIds) { + if (CollectionUtils.isEmpty(salaryAcctRecordIds)) { + return Collections.emptyList(); + } + return getSalaryAcctTaxAgentMapper().listAcctTaxAgent(salaryAcctRecordIds); + } + + @Override + public List listByTaxCycleRange(YearMonthRange taxCycleRange) { + SalaryAcctTaxAgentPO queryWrapper = new SalaryAcctTaxAgentPO(); + if (Objects.nonNull(taxCycleRange.getStartMonth())) { + queryWrapper.setStartMonth(taxCycleRange.getStartMonth()); + } + if (Objects.nonNull(taxCycleRange.getEndMonth())) { + queryWrapper.setEndMonth(taxCycleRange.getEndMonth()); + } + return getSalaryAcctTaxAgentMapper().listByTaxCycleRange(queryWrapper); + } + // @Override -// public List listBySalaryAcctRecordIds(Collection salaryAcctRecordIds, String tenantKey) { -// if (CollectionUtils.isEmpty(salaryAcctRecordIds)) { -// return Collections.emptyList(); -// } -// return new LambdaQueryChainWrapper<>(salaryAcctTaxAgentMapper) -// .eq(SalaryAcctTaxAgentPO::getTenantKey, tenantKey) -// .eq(SalaryAcctTaxAgentPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) -// .in(SalaryAcctTaxAgentPO::getSalaryAcctRecordId, salaryAcctRecordIds) -// .list(); -// } -// -// @Override -// public List listByTaxCycleRange(YearMonthRange taxCycleRange, String tenantKey) { -// LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(); -// queryWrapper.eq(SalaryAcctTaxAgentPO::getTenantKey, tenantKey); -// queryWrapper.eq(SalaryAcctTaxAgentPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()); -// if (Objects.nonNull(taxCycleRange.getStartMonth())) { -// queryWrapper.ge(SalaryAcctTaxAgentPO::getTaxCycle, taxCycleRange.getStartMonth().toString()); -// } -// if (Objects.nonNull(taxCycleRange.getEndMonth())) { -// queryWrapper.le(SalaryAcctTaxAgentPO::getTaxCycle, taxCycleRange.getEndMonth().toString()); -// } -// return salaryAcctTaxAgentMapper.selectList(queryWrapper); -// } -// -// @Override -// public List initBySalaryAcctEmployees(List salaryAcctEmployees, Long employeeId, String tenantKey) { +// public List initBySalaryAcctEmployees(List salaryAcctEmployees) { // if (CollectionUtils.isEmpty(salaryAcctEmployees)) { // return Collections.emptyList(); // } @@ -89,19 +69,18 @@ // } // // @Override -// @Transactional(rollbackFor = Exception.class) -// public void batchSave(List salaryAcctTaxAgents, String tenantKey) { +// public void batchSave(List salaryAcctTaxAgents) { // if (CollectionUtils.isNotEmpty(salaryAcctTaxAgents)) { // saveBatch(salaryAcctTaxAgents); // } // } // // @Override -// public void deleteBySalaryAcctRecordIds(Collection salaryAcctRecordIds, String tenantKey) { +// public void deleteBySalaryAcctRecordIds(Collection salaryAcctRecordIds) { // if (CollectionUtils.isEmpty(salaryAcctRecordIds)) { // return; // } -// new LambdaUpdateChainWrapper<>(salaryAcctTaxAgentMapper) +// new LambdaUpdateChainWrapper<>(getSalaryAcctTaxAgentMapper()) // .eq(SalaryAcctTaxAgentPO::getTenantKey, tenantKey) // .eq(SalaryAcctTaxAgentPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) // .in(SalaryAcctTaxAgentPO::getSalaryAcctRecordId, salaryAcctRecordIds) @@ -109,4 +88,4 @@ // .set(SalaryAcctTaxAgentPO::getUpdateTime, LocalDateTime.now()) // .update(); // } -//} +} diff --git a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java index ad4fcb835..37c361add 100644 --- a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java @@ -1328,4 +1328,9 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe } return result; } + + @Override + public List listByRunStatus(List list) { + return getSalaryArchiveMapper().listSome(SalaryArchivePO.builder().runStatusList(list).build()); + } } diff --git a/src/com/engine/salary/service/impl/SalarySobInitServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobInitServiceImpl.java index d5414a8fe..d1ded8b46 100644 --- a/src/com/engine/salary/service/impl/SalarySobInitServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySobInitServiceImpl.java @@ -335,6 +335,12 @@ public class SalarySobInitServiceImpl extends AbstractSalarySobInitService { if (Objects.equals(declaredField.getName(), "addUpAdvanceTax")) { salarySobItem = salarySobItemMap.get("addUpTaxPayable"); } + if (Objects.equals(declaredField.getName(), "addUpTaxExemptIncome")) { + salarySobItem = salarySobItemMap.get("addUpTaxFreeIncome"); + } + if (Objects.equals(declaredField.getName(), "addUpTaxSavings")) { + salarySobItem = salarySobItemMap.get("addUpTaxDeduction"); + } if (!declaredField.isAnnotationPresent(SalaryFormulaVar.class) || Objects.isNull(salarySobItem)) { continue; } diff --git a/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java b/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java index 20ed01799..f778da6fd 100644 --- a/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java @@ -3,6 +3,7 @@ package com.engine.salary.service.impl; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.common.LocalDateRange; +import com.engine.salary.common.YearMonthRange; import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO; import com.engine.salary.entity.salaryitem.po.SalaryItemPO; @@ -357,4 +358,11 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration getTaxDeclarationMapper().batchInsert(taxDeclarations); } } + + @Override + public List listByTaxCycleRange(YearMonthRange yearMonthRange) { + return getTaxDeclarationMapper().listSome(TaxDeclarationPO.builder() + .salaryMonths(LocalDateRange.builder().fromDate(yearMonthRange.getStartMonth()).endDate(yearMonthRange.getEndMonth()).build()) + .build()); + } } diff --git a/src/com/engine/salary/service/impl/TaxDeclarationValueServiceImpl.java b/src/com/engine/salary/service/impl/TaxDeclarationValueServiceImpl.java index c2fe1eabc..f7aaf17c9 100644 --- a/src/com/engine/salary/service/impl/TaxDeclarationValueServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxDeclarationValueServiceImpl.java @@ -32,7 +32,7 @@ import java.util.*; import java.util.stream.Collectors; /** - * 涓◣鐢虫姤琛 + * 涓◣鐢虫姤琛 *

Copyright: Copyright (c) 2023

*

Company: 娉涘井杞欢

* @@ -92,7 +92,7 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar List employeeDeclares = getEmployeeDeclareService(user).listByTaxCycleAndTaxAgentIdAndEmployeeIds(taxDeclaration.getTaxCycle(), taxDeclaration.getTaxAgentId(), employeeIds); // 鏌ヨ浜哄憳淇℃伅 List simpleEmployeeIds = taxDeclarationValues.stream() - .filter(taxDeclarationValue -> Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue())) + .filter(taxDeclarationValue -> taxDeclarationValue.getEmployeeType() == null || Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue())) .map(TaxDeclarationValuePO::getEmployeeId) .distinct() .collect(Collectors.toList()); diff --git a/src/com/engine/salary/service/impl/TaxDeclareRecordServiceImpl.java b/src/com/engine/salary/service/impl/TaxDeclareRecordServiceImpl.java index 6991bdeea..0474f38d8 100644 --- a/src/com/engine/salary/service/impl/TaxDeclareRecordServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxDeclareRecordServiceImpl.java @@ -122,8 +122,9 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe return ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user); } - private SalaryAcctTaxAgentService salaryAcctTaxAgentService; - + private SalaryAcctTaxAgentService getSalaryAcctTaxAgentService(User user) { + return ServiceUtil.getService(SalaryAcctTaxAgentServiceImpl.class, user); + } private SalaryAcctEmployeeService getSalaryAcctEmployeeService(User user) { return ServiceUtil.getService(SalaryAcctEmployeeServiceImpl.class, user); } @@ -367,6 +368,9 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe getAddUpSituationService(user).batchSave(entry.getValue()); } } + + //鏇存柊鏍哥畻璁板綍鐘舵 + getSalaryAcctRecordService(user).updateStatusByIds(salaryAcctRecordIds, SalaryAcctRecordStatusEnum.DECLARED); } private TaxDeclarationResult generateReportPerRecord(TaxDeclareRecordPO taxDeclareRecord, List salaryAcctEmployees) { diff --git a/src/com/engine/salary/web/AddUpDeductionController.java b/src/com/engine/salary/web/AddUpDeductionController.java index b153fd475..821d24e59 100644 --- a/src/com/engine/salary/web/AddUpDeductionController.java +++ b/src/com/engine/salary/web/AddUpDeductionController.java @@ -7,6 +7,8 @@ import com.engine.common.util.ParamUtil; import com.engine.common.util.ServiceUtil; import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO; import com.engine.salary.entity.datacollection.dto.AddUpDeductionRecordDTO; +import com.engine.salary.entity.datacollection.dto.AddUpDeductionRequestFailListDTO; +import com.engine.salary.entity.datacollection.dto.AddUpDeductionRequestResultDTO; import com.engine.salary.entity.datacollection.param.*; import com.engine.salary.util.ResponseResult; import com.engine.salary.util.SalaryDateUtil; @@ -22,10 +24,7 @@ import weaver.hrm.User; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; +import javax.ws.rs.*; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; @@ -271,8 +270,8 @@ public class AddUpDeductionController { } /** - * @description 鏂板缓绱涓撻」闄勫姞鎵i櫎 * @return String + * @description 鏂板缓绱涓撻」闄勫姞鎵i櫎 * @author Harryxzy * @date 2022/10/26 14:23 */ @@ -285,8 +284,8 @@ public class AddUpDeductionController { } /** - * @description 鑾峰彇绱涓撻」闄勫姞鎵i櫎淇℃伅 * @return String + * @description 鑾峰彇绱涓撻」闄勫姞鎵i櫎淇℃伅 * @author Harryxzy * @date 2022/10/31 11:23 */ @@ -300,8 +299,8 @@ public class AddUpDeductionController { /** - * @description 缂栬緫绱涓撻」闄勫姞鎵i櫎 * @return String + * @description 缂栬緫绱涓撻」闄勫姞鎵i櫎 * @author Harryxzy * @date 2022/10/25 14:08 */ @@ -314,8 +313,8 @@ public class AddUpDeductionController { } /** - * @description 绱涓撻」闄勫姞鎵i櫎-鍒犻櫎鎵閫 * @return String + * @description 绱涓撻」闄勫姞鎵i櫎-鍒犻櫎鎵閫 * @author Harryxzy * @date 2022/10/27 14:08 */ @@ -328,8 +327,8 @@ public class AddUpDeductionController { } /** - * @description 绱涓撻」闄勫姞鎵i櫎-涓閿竻绌 * @return String + * @description 绱涓撻」闄勫姞鎵i櫎-涓閿竻绌 * @author Harryxzy * @date 2022/10/27 14:08 */ @@ -353,6 +352,7 @@ public class AddUpDeductionController { /** * 涓閿嚜鍔ㄧ疮璁 + * * @return */ @POST @@ -374,4 +374,107 @@ public class AddUpDeductionController { User user = HrmUserVarify.getUser(request, response); return new ResponseResult(user).run(getAddUpDeductionWrapper(user)::autoAddAll, date); } + + + /** + * 鍦ㄧ嚎鑾峰彇 + * + * @param param 鍓嶇璇锋眰鍙傛暟 + * @return WeaResult 鎺ュ彛杩斿洖淇℃伅 + */ + @Path("/online/request") + @POST + @Produces(MediaType.APPLICATION_JSON) + public String onlineRequest(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AddUpDeductionMonthTaxAgentParam param) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>(user).run(getAddUpDeductionWrapper(user)::onlineRequest, param); + } + + /** + * 鍦ㄧ嚎鑾峰彇缁撴灉鏌ヨ + * + * @return WeaResult 鎺ュ彛杩斿洖淇℃伅 + */ + @Path("/online/feedback") + @GET + @Produces(MediaType.APPLICATION_JSON) + public String onlineFeedback(@Context HttpServletRequest request, @Context HttpServletResponse response) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult(user).run(getAddUpDeductionWrapper(user)::onlineFeedback); + } + + /** + * 鍦ㄧ嚎鑾峰彇澶辫触缁撴灉鏌ヨ + * + * @return WeaResult 鎺ュ彛杩斿洖淇℃伅 + */ + @Path("/online/feedback/fail") + @POST + @Produces(MediaType.APPLICATION_JSON) + public String onlineFeedbackFail(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AddUpDeductionRequestFailQueryParam queryParam) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>(user).run(getAddUpDeductionWrapper(user)::onlineFeedbackFail, queryParam); + } + + /** + * 鍦ㄧ嚎鑾峰彇缁撴灉瀵煎嚭 + * + * @return WeaResult 鎺ュ彛杩斿洖淇℃伅 + */ + @GET + @Path("/online/feedback/fail/export") + @Produces(MediaType.APPLICATION_OCTET_STREAM) + public Response exportOnlineFeedbackFail(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "requestId") Long requestId) { + try { + User user = HrmUserVarify.getUser(request, response); + + + XSSFWorkbook workbook = getAddUpDeductionWrapper(user).exportOnlineFeedbackFail(requestId); + + String fileName = "鍦ㄧ嚎鑾峰彇涓撻」闄勫姞鎵i櫎澶辫触鏁版嵁" + LocalDate.now(); + + try { + fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8"); + } catch (UnsupportedEncodingException e) { + log.error(e.getMessage(), e); + } + + StreamingOutput output = outputStream -> { + workbook.write(outputStream); + outputStream.flush(); + }; + response.setContentType("application/octet-stream"); + return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build(); + + } catch (Exception e) { + log.error("寰鏈熺疮璁℃儏鍐靛鍏ユā鏉垮鍑哄紓甯", e); + throw e; + } + } + +// /** +// * 鍦ㄧ嚎鑾峰彇琛ㄥ崟 +// * +// * @return WeaResult 杩斿洖缁撴灉 +// */ +// @Path("/online/request/form") +// @GET +// @Produces(MediaType.APPLICATION_JSON) +// public String getForm() { +// return WeaResult.success(addUpDeductionWrapper.getRequestForm()); +// } + +// /** +// * 鑷姩璁$畻娆℃湀 +// * +// * @param queryParam 鏌ヨ鏉′欢 +// * @return WeaResult 杩斿洖缁撴灉 +// */ +// @Path("/autoCalculate") +// @POST +// @Produces(MediaType.APPLICATION_JSON) +// public String autoCalculate(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AddUpDeductionQueryParam queryParam) { +// addUpDeductionWrapper.autoCalculate(queryParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()); +// return WeaResult.success(null); +// } } diff --git a/src/com/engine/salary/web/AddUpSituationController.java b/src/com/engine/salary/web/AddUpSituationController.java index 0c31aa578..1823c81b3 100644 --- a/src/com/engine/salary/web/AddUpSituationController.java +++ b/src/com/engine/salary/web/AddUpSituationController.java @@ -354,4 +354,17 @@ public class AddUpSituationController { } + /** + * 鍦ㄧ嚎鑾峰彇瀹為檯绱宸查鎵i缂寸◣棰 + * + * @param param 鍓嶇璇锋眰鍙傛暟 + * @return WeaResult 鎺ュ彛杩斿洖淇℃伅 + */ + @POST + @Path("/online/actualAddUpAdvanceTax") + @Produces(MediaType.APPLICATION_JSON) + public String onlineRequest(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody AddUpDeductionMonthTaxAgentParam param) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>(user).run(getAddUpSituationWrapper(user)::onlineRequest, param); + } } diff --git a/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java b/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java index aa89c3c58..614763634 100644 --- a/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java +++ b/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java @@ -5,10 +5,10 @@ import com.engine.core.impl.Service; import com.engine.salary.entity.datacollection.AddUpDeduction; import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO; import com.engine.salary.entity.datacollection.dto.AddUpDeductionRecordDTO; -import com.engine.salary.entity.datacollection.param.AddUpDeductionImportParam; -import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam; -import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordDeleteParam; -import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordParam; +import com.engine.salary.entity.datacollection.dto.AddUpDeductionRequestFailListDTO; +import com.engine.salary.entity.datacollection.dto.AddUpDeductionRequestResultDTO; +import com.engine.salary.entity.datacollection.param.*; +import com.engine.salary.entity.datacollection.po.AddUpDeductionRequestFailPO; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.service.AddUpDeductionService; import com.engine.salary.service.SalaryEmployeeService; @@ -179,4 +179,36 @@ public class AddUpDeductionWrapper extends Service { } return getAddUpDeductionService(user).autoAddAll(yearMonth, null); } + + public Map onlineRequest(AddUpDeductionMonthTaxAgentParam param) { + return getAddUpDeductionService(user).onlineRequest(param); + } + + public AddUpDeductionRequestResultDTO onlineFeedback() { + return getAddUpDeductionService(user).onlineFeedback(); + } + + public PageInfo onlineFeedbackFail(AddUpDeductionRequestFailQueryParam queryParam) { + if (queryParam.getRequestId() == null) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(153345, "鍦ㄧ嚎鑾峰彇鐨勮姹侷D涓嶅彲涓虹┖")); + } + PageInfo page = getAddUpDeductionService(user).onlineFeedbackFail(queryParam); + return page; + } + + public XSSFWorkbook exportOnlineFeedbackFail(Long requestId) { + List poList = getAddUpDeductionService(user).getAddUpDeductionRequestFailPOList(requestId); + if (CollectionUtils.isEmpty(poList)) { + throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel(95795, "鏁版嵁涓嶅瓨鍦") + "[id:%s]", requestId)); + } + return getAddUpDeductionService(user).exportOnlineFeedbackFail(requestId); + } + +// public WeaForm getRequestForm() { +// WeaForm weaForm = SalaryFormatUtil.getInstance().buildForm(AddUpDeductionRequestFormDTO.class, new AddUpDeductionRequestFormDTO()); +// WeaFormSalaryItem item = new WeaFormSalaryItem(WeaFormItemType.DATEPICKER, "month", "YYYY-MM", "YYYY-MM"); +// item.setRequired(true); +// weaForm.getItems().put("declareMonth", item); +// return weaForm; +// } } diff --git a/src/com/engine/salary/wrapper/AddUpSituationWrapper.java b/src/com/engine/salary/wrapper/AddUpSituationWrapper.java index 9e76f49b2..015dcb91f 100644 --- a/src/com/engine/salary/wrapper/AddUpSituationWrapper.java +++ b/src/com/engine/salary/wrapper/AddUpSituationWrapper.java @@ -5,10 +5,7 @@ import com.engine.core.impl.Service; import com.engine.salary.entity.datacollection.AddUpSituation; import com.engine.salary.entity.datacollection.dto.AddUpSituationDTO; import com.engine.salary.entity.datacollection.dto.AddUpSituationRecordDTO; -import com.engine.salary.entity.datacollection.param.AddUpSituationDeleteParam; -import com.engine.salary.entity.datacollection.param.AddUpSituationImportParam; -import com.engine.salary.entity.datacollection.param.AddUpSituationParam; -import com.engine.salary.entity.datacollection.param.AddUpSituationQueryParam; +import com.engine.salary.entity.datacollection.param.*; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.service.AddUpSituationService; import com.engine.salary.service.impl.AddUpSituationServiceImpl; @@ -169,4 +166,8 @@ public class AddUpSituationWrapper extends Service { public AddUpSituationRecordDTO getAddUpSituation(AddUpSituationParam addUpSituationParam) { return getAddUpSituationService(user).getAddUpSituation(addUpSituationParam); } + + public Map onlineRequest(AddUpDeductionMonthTaxAgentParam param) { + return getAddUpSituationService(user).onlineRequest(param); + } }