Merge branch 'release/个税版本' into custom/艾志工业-个税申报

# Conflicts:
#	src/com/engine/salary/service/SalaryArchiveService.java
#	src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java
This commit is contained in:
Harryxzy 2023-09-12 11:19:30 +08:00
commit 59d3aa758d
88 changed files with 4447 additions and 529 deletions

View File

@ -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
);
/

View File

@ -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);
/

View File

@ -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;
/

View File

@ -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
);
/

View File

@ -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);
/

View File

@ -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;
/

View File

@ -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
);
/

View File

@ -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);
/

View File

@ -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;
/

View File

@ -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'
)
;

View File

@ -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);

View File

@ -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;

View File

@ -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
)
/

View File

@ -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)
/

View File

@ -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
/

View File

@ -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
);
/

View File

@ -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);
/

View File

@ -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
/

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
);
/

View File

@ -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);
/

View File

@ -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;
/

View File

@ -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";
/**

View File

@ -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;
/**
* 实际累计已预扣预缴税额
*/
@SalaryFormulaVar(defaultLabel = "实际累计已预扣预缴税额", 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;
/**
* 创建时间
*/

View File

@ -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<Map<String, Object>> getEmployeeList(List<EmployeeDeclarePO> declarePOList) {
// List<Map<String, Object>> employeeList = new ArrayList<>();
// for (EmployeeDeclarePO employeeDeclarePO : declarePOList) {
// Map<String, Object> 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<Map<String, Object>> getEmployeeList(List<EmployeeDeclarePO> declarePOList) {
List<Map<String, Object>> employeeList = new ArrayList<>();
for (EmployeeDeclarePO employeeDeclarePO : declarePOList) {
Map<String, Object> 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())

View File

@ -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;
/**
* 数据采集-累计专项附加扣除-在线获取失败列表
*
* @author chengliming
* @date 2022-11-07 15:01:25
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("数据采集-累计专项附加扣除-在线获取失败列表")
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 = "个税扣缴义务人", labelId = 86184, width = "150")
@ApiModelProperty("个税扣缴义务人")
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;
}

View File

@ -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;
/**
* 数据采集-累计专项附加扣除-在线获取结果
*
* @author chengliming
* @date 2022-11-01 09:47:27
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@ApiModel("数据采集-累计专项附加扣除-在线获取结果")
public class AddUpDeductionRequestResultDTO {
@ApiModelProperty("请求id")
private String requestId;
@ApiModelProperty("提示语")
private String msg;
@ApiModelProperty("处理结果")
private String result;
@ApiModelProperty("是否结束轮询")
private Boolean finish;
}

View File

@ -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;
//个税扣缴义务人
@SalaryTableColumn(text = "个税扣缴义务人", width = "10%", column = "taxAgentName")
@TableTitle(title = "个税扣缴义务人", 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;
//累计其他扣除
@SalaryTableColumn(text = "累计其他扣除", width = "10%", column = "addUpOtherDeduction")
@TableTitle(title = "累计其他扣除", dataIndex = "addUpOtherDeduction", key = "addUpOtherDeduction")
@ExcelProperty(index = 18)
@TableTitle(title = "累计其他免税扣除", 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;
//累计准予扣除的捐赠额
@SalaryTableColumn(text = "累计准予扣除的捐赠额", width = "10%", column = "addUpAllowedDonation")
@TableTitle(title = "累计准予扣除的捐赠额", 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;
//累计已预扣预缴税额
@SalaryTableColumn(text = "累计已预扣预缴税额", width = "10%", column = "addUpAdvanceTax")
@TableTitle(title = "累计已预扣预缴税额", 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")
/**
* 实际累计已预扣预缴税额
*/
@ExcelProperty(index = 17)
@TableTitle(title = "实际累计已预扣预缴税额", 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;
}

View File

@ -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 = "累计其他扣除", width = "10%", column = "addUpOtherDeduction")
@TableTitle(title = "累计其他扣除", dataIndex = "addUpOtherDeduction", key = "addUpOtherDeduction")
//累计其他扣除
@TableTitle(title = "累计其他免税扣除", 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 = "累计准予扣除的捐赠额", width = "10%", column = "addUpAllowedDonation")
//累计准予扣除的捐赠额
@TableTitle(title = "累计准予扣除的捐赠额", 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 = "累计已预扣预缴税额", width = "10%", column = "addUpAdvanceTax")
//累计已预扣预缴税额
@TableTitle(title = "累计已预扣预缴税额", 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;
/**
* 实际累计已预扣预缴税额
*/
@ExcelProperty(index = 17)
@TableTitle(title = "实际累计已预扣预缴税额", 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;
}

View File

@ -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;
/**
* 数据采集-累计专项附加月份+扣缴主体参数
*
* @author : chengliming
* @Date: 2022-09-29 10:38:25
*/
@Data
@ApiModel("数据采集-累计专项附加月份+扣缴主体参数")
public class AddUpDeductionMonthTaxAgentParam {
@ApiModelProperty("税款所属期")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date declareMonth;
@ApiModelProperty("个税扣缴义务人的主键id")
private Long taxAgentId;
}

View File

@ -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.*;
/**
* 数据采集-累计专项附加扣除-在线获取失败记录查询参数
*
* @author chengliming
* @date 2022-11-01 14:40:36
*/
@EqualsAndHashCode(callSuper = true)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("数据采集-累计专项附加扣除-在线获取失败记录查询参数")
public class AddUpDeductionRequestFailQueryParam extends BaseQueryParam {
@ApiModelProperty("请求ID")
private Long requestId;
}

View File

@ -98,4 +98,13 @@ public class AddUpSituationParam {
//累计个人养老金
private String addUpPrivatePension;
//实际累计已预扣预缴税额
private String actualAddUpAdvanceTax;
//个税调差
private String taxAdjustment;
//累计应纳税所得额
private String addUpTaxableIncome;
}

View File

@ -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;
/**
* 数据采集-累计专项附加扣除在线查询失败表
* <p>Copyright: Copyright (c) 2023</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//hrsa_add_up_deduction_req_fail")
//数据采集-累计专项附加扣除在线查询失败表")
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;
//创建人id", 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;
//个税扣缴义务人ID")
private Long taxAgentId;
//失败原因")
private String reason;
//税款所属期")
private Date taxYearMonth;
/**
* @see EmployeeTypeEnum
*/
//人员类型")
private Integer employeeType;
private Collection<Long> ids;
}

View File

@ -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;
/**
* 数据采集-累计专项附加扣除在线查询表
*
* @author chengliming
* @date: 2022-10-26 16:07:04
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//hrsa_add_up_deduction_request
//数据采集-累计专项附加扣除在线查询表
public class AddUpDeductionRequestPO implements Serializable {
private static final long serialVersionUID = 1452863635879051515L;
//ID
private Long id;
//创建时间"
private Date createTime;
//修改时间"
private Date updateTime;
//创建人id"
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;
//个税扣缴义务人ID
private Long taxAgentId;
private Collection<Long> ids;
private Collection<Integer> requestStatuss;
private Integer oldStatus;
private Integer oldLockVersion;
}

View File

@ -0,0 +1,51 @@
package com.engine.salary.entity.datacollection.po;
import java.time.LocalDateTime;
/**
* 数据采集-抽象接口-方便使用泛型封装方法(po继承类会导致加密aop报错原因不知所以这里使用接口抽象)
*
* @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);
}

View File

@ -17,6 +17,7 @@ import java.util.Date;
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
//hrsa_special_add_deduction
public class SpecialAddDeductionPO {
private Long id;

View File

@ -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;
/**
* 人员专项附加扣除信息查询结果
*
* @author chengliming
* @date 2022-10-27 10:00 AM
**/
@Data
@EqualsAndHashCode(callSuper = true)
public class GetCompanyIncomesResponse extends BaseResponse {
/**
* 返回数据
*/
private Body body;
/**
* 人员专项附加扣除信息查询结果body
**/
@Data
public static class Body {
/**
* 明细
*/
private List<Detail> 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;
/**
* 允许扣除的费用
**/
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;
/**
* 其它扣除
**/
private String qt;
/**
* 准予扣除的捐赠额
**/
private String zykcjze;
/**
* 累计收入额
**/
private String ljsre;
/**
* 累计减除费用
**/
private String ljjcfy;
/**
* 累计专项扣除
**/
private String ljzxkc;
/**
* 累计子女教育
**/
private String ljznjy;
/**
* 累计赡养老人
**/
private String ljsylr;
/**
* 累计住房贷款利息
**/
private String ljzfdklx;
/**
* 累计住房租金
**/
private String ljzfzj;
/**
* 累计继续教育
**/
private String ljjxjy;
/**
* 累计3岁以下婴幼儿照护支出
**/
private String ljyyezhzc;
/**
* 累计其它扣除
**/
private String ljqtkc;
/**
* 累计准予扣除的捐赠额
**/
private String ljzykcjze;
/**
* 累计个人养老金
**/
private String ljgrylj;
/**
* 应纳税所得额
**/
private String ynssde;
/**
* 税率
**/
private String sl;
/**
* 协定税率
**/
private String xdsl;
/**
* 速算扣除数
**/
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;
/**
* 股票代码
**/
private String gpdm;
/**
* 股票名称
**/
private String gpmc;
/**
* 每股计税价格
**/
private String mgjsjg;
/**
* 转让股数
**/
private String zrgs;
/**
* 限售股原值
**/
private String xsgyz;
/**
* 合理税费
**/
private String hlsf;
/**
* 扣除及减除项目合计
**/
private String kcjjcxmhj;
}
/**
* 合计
*/
@Data
public static class Sum {
/**
* 收入额合计
*/
private String srehj;
/**
* 免税收入合计
*/
private String mssrhj;
/**
* 财产原值合计
*/
private String ccyzhj;
/**
* 投资抵扣合计
*/
private String tzdkhj;
/**
* 允许扣除的税费合计
*/
private String yxkcsfhj;
/**
* 基本养老保险费合计
*/
private String jbylaobxfhj;
/**
* 基本医疗保险费合计
*/
private String jbylbxfhj;
/**
* 失业保险费合计
*/
private String sybxfhj;
/**
* 住房公积金合计
*/
private String zfgjjhj;
/**
* 年金合计
*/
private String njhj;
/**
* 商业健康保险合计
*/
private String syjkbxhj;
/**
* 税延养老保险合计
*/
private String syylbxhj;
/**
* 其他扣除合计
*/
private String qthj;
/**
* 准予扣除的捐赠额合计
*/
private String zykcjzehj;
/**
* 累计收入额合计
*/
private String ljsrehj;
/**
* 累计专项扣除合计
*/
private String ljzxkchj;
/**
* 累计子女教育合计
*/
private String ljznjyhj;
/**
* 累计赡养老人合计
*/
private String ljsylrhj;
/**
* 累计住房贷款利息合计
*/
private String ljzfdklxhj;
/**
* 累计住房租金合计
*/
private String ljzfzjhj;
/**
* 累计继续教育合计
*/
private String ljjxjyhj;
/**
* 累计3岁以下婴幼儿照护支出合计
*/
private String ljyyezhzchj;
/**
* 累计其他扣除合计
*/
private String ljqtkchj;
/**
* 累计准予扣除的捐赠额合计
*/
private String ljzykcjzehj;
/**
* 累计个人养老金合计
*/
private String ljgryljhj;
/**
* 应纳税所得额合计
*/
private String ynssdehj;
/**
* 应纳税额合计
*/
private String ynsehj;
/**
* 减免税额合计
*/
private String jmsehj;
/**
* 已扣缴税额合计
*/
private String ykjsehj;
/**
* 应补退税额合计
*/
private String ybtsehj;
}
}

View File

@ -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;
/**
* 人员专项附加扣除信息查询结果
* <p>Copyright: Copyright (c) 2023</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@EqualsAndHashCode(callSuper = true)
public class QuerySpecialAmountResponse extends BaseResponse {
/**
* 返回数据
*/
private QuerySpecialAmountBody body;
private Body body;
/**
* 人员专项附加扣除信息查询结果body
**/
@Data
public static class QuerySpecialAmountBody {
public static class Body {
/**
* 请求查询ID
*/

View File

@ -219,4 +219,5 @@ public class EmployeeDeclarePO {
private Collection<Long> ids;
private Collection<Long> employeeIds;
private Collection<Long> taxAgentIds;
}

View File

@ -68,7 +68,7 @@ public class SalaryAcctCalculateBO {
/**
* 本次运算的薪资项目已排好运算优先级
*/
private List<List<Long>> salaryItemIdWithPriorityList;
private List<Long> salaryItemIdWithPriorityList;
/**
* 本次运算涉及的所有公式

View File

@ -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;
/**
* 薪资核算-薪资项目运算优先级
* <p>Copyright: Copyright (c) 2022</p>
@ -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+)";
/**
* 解析公式中变量的fieldId的正则表达式
*/
private static final Pattern SALARY_PATTERN = Pattern.compile(SALARY_REGEX);
/**
* 计算优先级
*

View File

@ -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;
/**
* 薪资核算涉及的薪资项目
* <p>Copyright: Copyright (c) 2023</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Accessors(chain = true)
public class SalaryCalcItem {
/**
* 薪资项目id
*/
private Long salaryItemId;
/**
* 薪资项目编号
*/
private String salaryItemCode;
/**
* 所得项目
*/
private String incomeCategory;
/**
* 薪资档案引用0薪资档案未引用1薪资档案引用
* 为处理历史数据而留不再使用
*/
@Deprecated
private Integer useInEmployeeSalary;
/**
* 字段类型
* @see SalaryDataTypeEnum
*/
private String dataType;
/**
* 舍入规则
* @see SalaryRoundingModeEnum
*/
private Integer roundingMode;
/**
* 小数位数
*/
private Integer pattern;
/**
* 公式
*/
private ExpressFormula expressFormula;
}

View File

@ -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;
/**
* 对薪资核算时涉及的薪资项目进行排序
* <p>Copyright: Copyright (c) 2023</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalaryCalcItemGraph {
private List<SalaryCalcItemGraphNode> nodes;
/**
* 根据薪资账套的薪资项目公式详情构建实例
*
* @param salarySobItems 薪资账套的薪资项目
* @param expressFormulas 公式详情
*/
public SalaryCalcItemGraph(List<SalarySobItemPO> salarySobItems, List<SalaryItemPO> salaryItemPOS, List<ExpressFormula> expressFormulas) {
Map<String, SalarySobItemPO> salarySobItemMap = SalaryEntityUtil.convert2Map(salarySobItems, SalarySobItemPO::getSalaryItemCode);
Map<String, SalaryItemPO> salaryItemMap = SalaryEntityUtil.convert2Map(salaryItemPOS, SalaryItemPO::getCode);
Map<Long, ExpressFormula> expressFormulaMap = SalaryEntityUtil.convert2Map(expressFormulas, ExpressFormula::getId);
Map<Long, List<FormulaVar>> formulaVarMap = ExpressFormulaBO.buildFormulaVar(expressFormulas);
Map<Long, SalaryCalcItemGraphNode> 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<FormulaVar> 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<SalaryCalcItem> sort() {
// 循环遍历所有顶点
for (SalaryCalcItemGraphNode node : nodes) {
// 循环遍历每个顶点的邻居
for (SalaryCalcItemGraphNode destNode : node.getDestNodes()) {
// 维护每个顶点的入度
destNode.setInDegree(destNode.getInDegree() + 1);
}
}
// 创建一个队列
LinkedTransferQueue<SalaryCalcItemGraphNode> queue = new LinkedTransferQueue<>();
// 再次循环所有顶点
for (SalaryCalcItemGraphNode node : nodes) {
// 若该顶点入度为0则加入队列
if (node.getInDegree() == 0) {
queue.offer(node);
}
}
// 存储结果的列表
List<SalaryCalcItem> 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 {
/**
* 薪资项目的id
*/
private SalaryCalcItem salaryCalcItem;
/**
* 入度
*/
private int inDegree;
/**
* 是否已被访问
*/
private boolean visited;
/**
* 当前顶点的邻居
*/
private List<SalaryCalcItemGraphNode> 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<>();
}
}
}

View File

@ -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;
}

View File

@ -145,6 +145,7 @@ public class TaxAgentTaxReturnPO implements Serializable {
//查询条件
private Collection<Long> ids;
private Collection<Long> taxAgentIds;
private Collection<String> taxCodes;
}

View File

@ -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())

View File

@ -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());

View File

@ -0,0 +1,52 @@
package com.engine.salary.enums.datacollection;
import java.util.HashMap;
import java.util.Map;
/**
* 累计附加扣除请求外部接口处理状态
*
* @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<Integer, String> 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);
}
}

View File

@ -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;
/**
* 薪资核算维护类
* <p>Copyright: Copyright (c) 2022</p>
@ -294,9 +301,10 @@ public class SalaryAcctManager extends Service {
formulaIds.addAll(SalaryEntityUtil.properties(salarySobBackItems, SalarySobBackItemPO::getFormulaId));
List<ExpressFormula> expressFormulas = getSalaryFormulaService(user).listExpressFormula(formulaIds);
// 本次运算的回算薪资项目所涉及的变量
Set<String> issuedFieldIds = new HashSet<>();
Set<String> issuedFieldIds = getIssuedFieldIds(salarySobBackItems);
// 9计算薪资项目的运算优先级
List<List<Long>> salarySobItemsWithPriority = SalaryAcctCalculatePriorityBO.calculatePriority(salarySobItemPOS, salaryItemPOS, expressFormulas, salarySobBackItems, issuedFieldIds);
// List<List<Long>> salarySobItemsWithPriority = SalaryAcctCalculatePriorityBO.calculatePriority(salarySobItemPOS, salaryItemPOS, expressFormulas, salarySobBackItems, issuedFieldIds);
List<Long> salarySobItemsWithPriority = sortItems(salarySobItemPOS, salarySobBackItems, salaryItemPOS, expressFormulas);
// 10根据id查询其他合并计税的薪资核算记录
List<SalaryAcctRecordPO> otherSalaryAcctRecordPOS = getSalaryAcctRecordService(user).listById4OtherConsolidatedTax(salaryAcctRecordPO.getId());
// 11查询本次核算人员
@ -396,5 +404,43 @@ public class SalaryAcctManager extends Service {
getSalaryAcctResultTempService(user).deleteByCalculateKey(calculateKey);
}
@NotNull
private List<Long> sortItems(List<SalarySobItemPO> salarySobItemPOS, List<SalarySobBackItemPO> salarySobBackItems, List<SalaryItemPO> salaryItemPOS, List<ExpressFormula> expressFormulas) {
List<SalarySobItemPO> 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<SalaryCalcItem> salaryCalcItems = salaryCalcItemGraph.sort();
return SalaryEntityUtil.properties(salaryCalcItems, SalaryCalcItem::getSalaryItemId, Collectors.toList());
}
/**
* 获取回算变量
*
* @param salarySobBackItems
* @return
*/
@NotNull
private Set<String> getIssuedFieldIds(List<SalarySobBackItemPO> salarySobBackItems) {
Set<String> issuedFieldIds;
Set<Long> issuedFormulaIds = SalaryEntityUtil.properties(salarySobBackItems, SalarySobBackItemPO::getFormulaId);
List<ExpressFormula> expressFormulas1 = getSalaryFormulaService(user).listExpressFormula(issuedFormulaIds);
List<FormulaVar> 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;
}
}

View File

@ -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<AddUpDeductionRequestFailPO> listAll();
/**
* 条件查询
*
* @return 返回集合没有返回空List
*/
List<AddUpDeductionRequestFailPO> listSome(AddUpDeductionRequestFailPO addUpDeductionReqFail);
/**
* 根据主键查询
*
* @param id 主键
* @return 返回记录没有返回null
*/
AddUpDeductionRequestFailPO getById(Long id);
/**
* 新增忽略null字段
*
* @param addUpDeductionReqFail 新增的记录
* @return 返回影响行数
*/
int insertIgnoreNull(AddUpDeductionRequestFailPO addUpDeductionReqFail);
/**
* 批量插入
*
* @param list
*/
void batchInsert(@Param("collection") Collection<AddUpDeductionRequestFailPO> list);
/**
* 修改修改所有字段
*
* @param addUpDeductionReqFail 修改的记录
* @return 返回影响行数
*/
int update(AddUpDeductionRequestFailPO addUpDeductionReqFail);
/**
* 修改忽略null字段
*
* @param addUpDeductionReqFail 修改的记录
* @return 返回影响行数
*/
int updateIgnoreNull(AddUpDeductionRequestFailPO addUpDeductionReqFail);
/**
* 删除记录
*
* @param addUpDeductionReqFail 待删除的记录
* @return 返回影响行数
*/
int delete(AddUpDeductionRequestFailPO addUpDeductionReqFail);
/**
* 批量删除记录
* @param ids 主键id集合
*/
void deleteByIds(@Param("ids") Collection<Long> ids);
}

View File

@ -0,0 +1,384 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.engine.salary.mapper.datacollection.AddUpDeductionRequestFailMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.datacollection.po.AddUpDeductionRequestFailPO">
<result column="create_time" property="createTime"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="employee_id" property="employeeId"/>
<result column="employee_type" property="employeeType"/>
<result column="id" property="id"/>
<result column="outer_request_id" property="outerRequestId"/>
<result column="reason" property="reason"/>
<result column="request_id" property="requestId"/>
<result column="tax_agent_id" property="taxAgentId"/>
<result column="tax_year_month" property="taxYearMonth"/>
<result column="tenant_key" property="tenantKey"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
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
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hrsa_add_up_deduction_req_fail t
WHERE delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns"/>
FROM hrsa_add_up_deduction_req_fail t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap"
parameterType="com.engine.salary.entity.datacollection.po.AddUpDeductionRequestFailPO">
SELECT
<include refid="baseColumns"/>
FROM hrsa_add_up_deduction_req_fail t
WHERE delete_type = 0
<if test="createTime != null">
AND create_time = #{createTime}
</if>
<if test="creator != null">
AND creator = #{creator}
</if>
<if test="deleteType != null">
AND delete_type = #{deleteType}
</if>
<if test="employeeId != null">
AND employee_id = #{employeeId}
</if>
<if test="employeeType != null">
AND employee_type = #{employeeType}
</if>
<if test="id != null">
AND id = #{id}
</if>
<if test="outerRequestId != null">
AND outer_request_id = #{outerRequestId}
</if>
<if test="reason != null">
AND reason = #{reason}
</if>
<if test="requestId != null">
AND request_id = #{requestId}
</if>
<if test="taxAgentId != null">
AND tax_agent_id = #{taxAgentId}
</if>
<if test="taxYearMonth != null">
AND tax_year_month = #{taxYearMonth}
</if>
<if test="tenantKey != null">
AND tenant_key = #{tenantKey}
</if>
<if test="updateTime != null">
AND update_time = #{updateTime}
</if>
<if test="ids != null and ids.size()>0">
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
ORDER BY id DESC
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull"
parameterType="com.engine.salary.entity.datacollection.po.AddUpDeductionRequestFailPO">
INSERT INTO hrsa_add_up_deduction_req_fail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="createTime != null">
create_time,
</if>
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="employeeId != null">
employee_id,
</if>
<if test="employeeType != null">
employee_type,
</if>
<if test="id != null">
id,
</if>
<if test="outerRequestId != null">
outer_request_id,
</if>
<if test="reason != null">
reason,
</if>
<if test="requestId != null">
request_id,
</if>
<if test="taxAgentId != null">
tax_agent_id,
</if>
<if test="taxYearMonth != null">
tax_year_month,
</if>
<if test="tenantKey != null">
tenant_key,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="createTime != null">
#{createTime},
</if>
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="employeeId != null">
#{employeeId},
</if>
<if test="employeeType != null">
#{employeeType},
</if>
<if test="id != null">
#{id},
</if>
<if test="outerRequestId != null">
#{outerRequestId},
</if>
<if test="reason != null">
#{reason},
</if>
<if test="requestId != null">
#{requestId},
</if>
<if test="taxAgentId != null">
#{taxAgentId},
</if>
<if test="taxYearMonth != null">
#{taxYearMonth},
</if>
<if test="tenantKey != null">
#{tenantKey},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
</trim>
</insert>
<insert id="batchInsert">
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
<foreach collection="collection" item="item" separator=",">
(
#{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}
)
</foreach>
</insert>
<insert id="batchInsert" databaseId="postgresql">
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
<foreach collection="collection" item="item" separator=",">
(
#{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}
)
</foreach>
</insert>
<insert id="batchInsert" databaseId="oracle">
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)
<foreach collection="collection" item="item" separator="union all">
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
</foreach>
</insert>
<insert id="batchInsert" databaseId="sqlserver">
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
<foreach collection="collection" item="item" separator=",">
(
#{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}
)
</foreach>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.entity.datacollection.po.AddUpDeductionRequestFailPO">
UPDATE hrsa_add_up_deduction_req_fail
<set>
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},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull"
parameterType="com.engine.salary.entity.datacollection.po.AddUpDeductionRequestFailPO">
UPDATE hrsa_add_up_deduction_req_fail
<set>
<if test="createTime != null">
create_time=#{createTime},
</if>
<if test="creator != null">
creator=#{creator},
</if>
<if test="deleteType != null">
delete_type=#{deleteType},
</if>
<if test="employeeId != null">
employee_id=#{employeeId},
</if>
<if test="employeeType != null">
employee_type=#{employeeType},
</if>
<if test="outerRequestId != null">
outer_request_id=#{outerRequestId},
</if>
<if test="reason != null">
reason=#{reason},
</if>
<if test="requestId != null">
request_id=#{requestId},
</if>
<if test="taxAgentId != null">
tax_agent_id=#{taxAgentId},
</if>
<if test="taxYearMonth != null">
tax_year_month=#{taxYearMonth},
</if>
<if test="tenantKey != null">
tenant_key=#{tenantKey},
</if>
<if test="updateTime != null">
update_time=#{updateTime},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 根据主键删除记录 -->
<delete id="delete">
UPDATE hrsa_add_up_deduction_req_fail
SET delete_type=1
WHERE id = #{id}
AND delete_type = 0
</delete>
<delete id="deleteByIds">
UPDATE hrsa_add_up_deduction_req_fail
SET delete_type = 1
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -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<AddUpDeductionRequestPO> listAll();
/**
* 条件查询
*
* @return 返回集合没有返回空List
*/
List<AddUpDeductionRequestPO> listSome(AddUpDeductionRequestPO addUpDeductionRequest);
/**
* 根据主键查询
*
* @param id 主键
* @return 返回记录没有返回null
*/
AddUpDeductionRequestPO getById(Long id);
/**
* 新增忽略null字段
*
* @param addUpDeductionRequest 新增的记录
* @return 返回影响行数
*/
int insertIgnoreNull(AddUpDeductionRequestPO addUpDeductionRequest);
/**
* 批量插入
*
* @param addUpDeductionRequest
*/
void batchInsert(@Param("collection") List<AddUpDeductionRequestPO> addUpDeductionRequest);
/**
* 修改修改所有字段
*
* @param addUpDeductionRequest 修改的记录
* @return 返回影响行数
*/
int update(AddUpDeductionRequestPO addUpDeductionRequest);
/**
* 修改忽略null字段
*
* @param addUpDeductionRequest 修改的记录
* @return 返回影响行数
*/
int updateIgnoreNull(AddUpDeductionRequestPO addUpDeductionRequest);
/**
* 删除记录
*
* @param addUpDeductionRequest 待删除的记录
* @return 返回影响行数
*/
int delete(AddUpDeductionRequestPO addUpDeductionRequest);
/**
* 批量删除记录
* @param ids 主键id集合
*/
void deleteByIds(@Param("ids") Collection<Long> ids);
int updateRequestStatusLockVersion(AddUpDeductionRequestPO build);
}

View File

@ -0,0 +1,388 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.engine.salary.mapper.datacollection.AddUpDeductionRequestMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.datacollection.po.AddUpDeductionRequestPO">
<result column="create_time" property="createTime"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="id" property="id"/>
<result column="lock_version" property="lockVersion"/>
<result column="outer_request_id" property="outerRequestId"/>
<result column="request_id" property="requestId"/>
<result column="request_status" property="requestStatus"/>
<result column="tax_agent_id" property="taxAgentId"/>
<result column="tax_year_month" property="taxYearMonth"/>
<result column="tenant_key" property="tenantKey"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
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
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hrsa_add_up_deduction_request t
WHERE delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns"/>
FROM hrsa_add_up_deduction_request t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap"
parameterType="com.engine.salary.entity.datacollection.po.AddUpDeductionRequestPO">
SELECT
<include refid="baseColumns"/>
FROM hrsa_add_up_deduction_request t
WHERE delete_type = 0
<if test="createTime != null">
AND create_time = #{createTime}
</if>
<if test="creator != null">
AND creator = #{creator}
</if>
<if test="deleteType != null">
AND delete_type = #{deleteType}
</if>
<if test="id != null">
AND id = #{id}
</if>
<if test="lockVersion != null">
AND lock_version = #{lockVersion}
</if>
<if test="outerRequestId != null">
AND outer_request_id = #{outerRequestId}
</if>
<if test="requestId != null">
AND request_id = #{requestId}
</if>
<if test="requestStatus != null">
AND request_status = #{requestStatus}
</if>
<if test="taxAgentId != null">
AND tax_agent_id = #{taxAgentId}
</if>
<if test="taxYearMonth != null">
AND tax_year_month = #{taxYearMonth}
</if>
<if test="tenantKey != null">
AND tenant_key = #{tenantKey}
</if>
<if test="updateTime != null">
AND update_time = #{updateTime}
</if>
<if test="ids != null and ids.size()>0">
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
ORDER BY id DESC
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.datacollection.po.AddUpDeductionRequestPO">
INSERT INTO hrsa_add_up_deduction_request
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="createTime != null">
create_time,
</if>
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="id != null">
id,
</if>
<if test="lockVersion != null">
lock_version,
</if>
<if test="outerRequestId != null">
outer_request_id,
</if>
<if test="requestId != null">
request_id,
</if>
<if test="requestStatus != null">
request_status,
</if>
<if test="taxAgentId != null">
tax_agent_id,
</if>
<if test="taxYearMonth != null">
tax_year_month,
</if>
<if test="tenantKey != null">
tenant_key,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="createTime != null">
#{createTime},
</if>
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="id != null">
#{id},
</if>
<if test="lockVersion != null">
#{lockVersion},
</if>
<if test="outerRequestId != null">
#{outerRequestId},
</if>
<if test="requestId != null">
#{requestId},
</if>
<if test="requestStatus != null">
#{requestStatus},
</if>
<if test="taxAgentId != null">
#{taxAgentId},
</if>
<if test="taxYearMonth != null">
#{taxYearMonth},
</if>
<if test="tenantKey != null">
#{tenantKey},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
</trim>
</insert>
<insert id="batchInsert">
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
(
<foreach collection="collection" item="item" separator=",">
#{item.createTime},
#{item.creator},
#{item.deleteType},
#{item.id},
#{item.lockVersion},
#{item.outerRequestId},
#{item.requestId},
#{item.requestStatus},
#{item.taxAgentId},
#{item.taxYearMonth},
#{item.tenantKey},
#{item.updateTime}
</foreach>
)
</insert>
<insert id="batchInsert" databaseId="oracle">
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
)
<foreach collection="collection" item="item" separator="union all">
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
</foreach>
</insert>
<insert id="batchInsert" databaseId="sqlserver">
<foreach collection="collection" item="item" separator=";">
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}
)
</foreach>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.entity.datacollection.po.AddUpDeductionRequestPO">
UPDATE hrsa_add_up_deduction_request
<set>
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},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.datacollection.po.AddUpDeductionRequestPO">
UPDATE hrsa_add_up_deduction_request
<set>
<if test="createTime != null">
create_time=#{createTime},
</if>
<if test="creator != null">
creator=#{creator},
</if>
<if test="deleteType != null">
delete_type=#{deleteType},
</if>
<if test="lockVersion != null">
lock_version=#{lockVersion},
</if>
<if test="outerRequestId != null">
outer_request_id=#{outerRequestId},
</if>
<if test="requestId != null">
request_id=#{requestId},
</if>
<if test="requestStatus != null">
request_status=#{requestStatus},
</if>
<if test="taxAgentId != null">
tax_agent_id=#{taxAgentId},
</if>
<if test="taxYearMonth != null">
tax_year_month=#{taxYearMonth},
</if>
<if test="tenantKey != null">
tenant_key=#{tenantKey},
</if>
<if test="updateTime != null">
update_time=#{updateTime},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 根据主键删除记录 -->
<delete id="delete">
UPDATE hrsa_add_up_deduction_request
SET delete_type=1
WHERE id = #{id}
AND delete_type = 0
</delete>
<delete id="deleteByIds">
UPDATE hrsa_add_up_deduction_request
SET delete_type = 1
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</delete>
<update id="updateRequestStatusLockVersion"
parameterType="com.engine.salary.entity.datacollection.po.AddUpDeductionRequestPO">
UPDATE hrsa_add_up_deduction_request
<set>
request_status=#{requestStatus},
lock_version=#{lockVersion},
update_time=#{updateTime},
</set>
WHERE delete_type = 0
AND request_status=#{oldStatus}
AND lock_version=#{oldLockVersion}
AND id = #{id}
</update>
</mapper>

View File

@ -20,6 +20,9 @@
<result column="add_up_tax_savings" property="addUpTaxSavings"/>
<result column="add_up_infant_care" property="addUpInfantCare"/>
<result column="add_up_private_pension" property="addUpPrivatePension"/>
<result column="actual_add_up_advance_tax" property="actualAddUpAdvanceTax"/>
<result column="tax_adjustment" property="taxAdjustment"/>
<result column="add_up_taxable_income" property="addUpTaxableIncome"/>
<result column="create_time" property="createTime"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
@ -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
</sql>
<!--批量删除-->
@ -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
</sql>
<sql id="paramSql">
@ -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
<foreach collection="collection" item="item" separator=",">
@ -468,7 +480,10 @@
#{item.addUpTaxSavings},
#{item.addUpIllnessMedical},
#{item.addUpInfantCare},
#{item.addUpPrivatePension}
#{item.addUpPrivatePension},
#{item.actualAddUpAdvanceTax},
#{item.taxAdjustment},
#{item.addUpTaxableIncome}
)
</foreach>
</insert>
@ -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
)
<foreach collection="collection" item="item" separator="union all">
@ -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
</foreach>
</insert>
@ -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}
)
</foreach>
</insert>
@ -724,6 +751,27 @@
</if>
</foreach>
</trim>
<trim prefix="actual_add_up_advance_tax =case" suffix="end,">
<foreach collection="collection" item="item" index="index">
<if test="item.actualAddUpAdvanceTax!=null">
when id=#{item.id} then #{item.actualAddUpAdvanceTax}
</if>
</foreach>
</trim>
<trim prefix="tax_adjustment =case" suffix="end,">
<foreach collection="collection" item="item" index="index">
<if test="item.taxAdjustment!=null">
when id=#{item.id} then #{item.taxAdjustment}
</if>
</foreach>
</trim>
<trim prefix="add_up_taxable_income =case" suffix="end,">
<foreach collection="collection" item="item" index="index">
<if test="item.addUpTaxableIncome!=null">
when id=#{item.id} then #{item.addUpTaxableIncome}
</if>
</foreach>
</trim>
</trim>
where
id in

View File

@ -202,6 +202,12 @@
#{id}
</foreach>
</if>
<if test="taxAgentIds != null and taxAgentIds.size()>0">
AND tax_agent_id IN
<foreach collection="taxAgentIds" open="(" item="taxAgentId" separator="," close=")">
#{taxAgentId}
</foreach>
</if>
ORDER BY id DESC
</select>

View File

@ -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<SalaryAcctTaxAgentPO> listAcctTaxAgent(@Param("salaryAcctRecordIds") Collection<Long> salaryAcctIds);
List<SalaryAcctTaxAgentPO> listByTaxCycleRange(SalaryAcctTaxAgentPO queryWrapper);
}

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.engine.salary.mapper.salaryacct.SalaryAcctTaxAgentMapper">
<select id="listAcctTaxAgent" resultType="com.engine.salary.entity.salaryacct.po.SalaryAcctTaxAgentPO">
select record.id as salaryAcctRecordId,
sob.income_category as incomeCategory,
sob.tax_agent_id as taxAgentId,
record.salary_month as salaryMonth,
record.tax_cycle as taxCycle
FROM hrsa_salary_acct_record record
left join hrsa_salary_sob sob
on record.salary_sob_id = sob.id
where record.delete_type = 0 and sob.delete_type = 0
<if test="salaryAcctRecordIds != null and salaryAcctRecordIds.size()>0">
AND record.id IN
<foreach collection="salaryAcctRecordIds" open="(" item="salaryAcctRecordId" separator="," close=")">
#{salaryAcctRecordId}
</foreach>
</if>
</select>
<select id="listByTaxCycleRange" resultType="com.engine.salary.entity.salaryacct.po.SalaryAcctTaxAgentPO">
select record.id as salaryAcctRecordId,
sob.income_category as incomeCategory,
sob.tax_agent_id as taxAgentId,
record.salary_month as salaryMonth,
record.tax_cycle as taxCycle
FROM hrsa_salary_acct_record record
left join hrsa_salary_sob sob
on record.salary_sob_id = sob.id
where record.delete_type = 0 and sob.delete_type = 0
<if test="startMonth != null">
AND record.tax_cycle >=#{startMonth}
</if>
<if test="endMonth != null">
AND record.tax_cycle &lt;=#{endMonth}
</if>
</select>
</mapper>

View File

@ -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";
}

View File

@ -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<String, Object> onlineRequest(AddUpDeductionMonthTaxAgentParam param);
/**
* 在线获取结果查询
*
* @return
*/
AddUpDeductionRequestResultDTO onlineFeedback();
/**
* 在线获取失败记录
*
* @param queryParam
* @return
*/
PageInfo<AddUpDeductionRequestFailListDTO> onlineFeedbackFail(AddUpDeductionRequestFailQueryParam queryParam);
/**
* 获取反馈失败记录
*
* @param requestId
* @return
*/
List<AddUpDeductionRequestFailPO> getAddUpDeductionRequestFailPOList(Long requestId);
/**
* 导出反馈失败记录
*
* @param requestId
*/
XSSFWorkbook exportOnlineFeedbackFail(Long requestId);
}

View File

@ -112,4 +112,12 @@ public interface AddUpSituationService {
* @date 2022/10/31 14:00
*/
AddUpSituationRecordDTO getAddUpSituation(AddUpSituationParam addUpSituationParam);
/**
* 在线获取实际累计已预扣预缴税额
*
* @param param
* @return
*/
Map<String, Object> onlineRequest(AddUpDeductionMonthTaxAgentParam param);
}

View File

@ -124,6 +124,13 @@ public interface SalaryAcctRecordService {
*/
Long save(SalaryAcctRecordSaveParam saveParam);
/**
* 保存之前检查一下是否可以新建核算
*
* @param salaryAcctTaxAgents
*/
void checkBeforeSave(SalaryAcctRecordPO salaryAcctRecord, List<SalaryAcctTaxAgentPO> salaryAcctTaxAgents);
/**
* 更新薪资核算记录的状态
*

View File

@ -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<SalaryAcctTaxAgentPO> listByTaxCycleRange(YearMonthRange taxCycleRange);
/**
* 根据薪资核算人员初始化
*
* @param salaryAcctEmployees
* @return
*/
List<SalaryAcctTaxAgentPO> initBySalaryAcctEmployees(List<SalaryAcctEmployeePO> salaryAcctEmployees);
/**
* 批量保存
*
* @param salaryAcctTaxAgents
*/
void batchSave(List<SalaryAcctTaxAgentPO> salaryAcctTaxAgents);
/**
* 根据薪资核算记录id删除关联的个税扣缴义务人
*
* @param salaryAcctRecordIds
*/
void deleteBySalaryAcctRecordIds(Collection<Long> salaryAcctRecordIds);
// /**
// * 根据薪资核算人员初始化
// *
// * @param salaryAcctEmployees
// * @return
// */
// List<SalaryAcctTaxAgentPO> initBySalaryAcctEmployees(List<SalaryAcctEmployeePO> salaryAcctEmployees);
//
// /**
// * 批量保存
// *
// * @param salaryAcctTaxAgents
// */
// void batchSave(List<SalaryAcctTaxAgentPO> salaryAcctTaxAgents);
//
// /**
// * 根据薪资核算记录id删除关联的个税扣缴义务人
// *
// * @param salaryAcctRecordIds
// */
// void deleteBySalaryAcctRecordIds(Collection<Long> salaryAcctRecordIds);
}

View File

@ -247,4 +247,6 @@ public interface SalaryArchiveService {
* @return
*/
Map<Long, String> getAzRyflInfo(List<Long> asList);
List<SalaryArchivePO> listByRunStatus(List<String> asList);
}

View File

@ -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<Long> taxDeclareRecordIds);
void saveBatch(List<TaxDeclarationPO> taxDeclarations);
/**
* 根据税款所属期查询个税申报表
*
* @param yearMonthRange
* @return
*/
List<TaxDeclarationPO> listByTaxCycleRange(YearMonthRange yearMonthRange);
}

View File

@ -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));

View File

@ -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<String, Object> getSearchCondition(Map<String, Object> params) {
Map<String, Object> apidatas = new HashMap<String, Object>();
@ -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<TaxAgentManageRangeEmployeeDTO> first = taxAgentList.stream().filter(m -> Objects.equals(m.getTaxAgentId() , byId.getTaxAgentId())).findFirst();
Optional<TaxAgentManageRangeEmployeeDTO> first = taxAgentList.stream().filter(m -> Objects.equals(m.getTaxAgentId(), byId.getTaxAgentId())).findFirst();
if (!first.isPresent()) {
throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内");
}
@ -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("个税扣缴义务人不存在或不在权限范围内!");
}
@ -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传true
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<TaxAgentEmployeeDTO> taxAgentEmployees = getTaxAgentService(user).listTaxAgentAndEmployee(employeeId);
List<Long> taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
// List<AddUpDeduction> lastList = getLastListByModifier(employeeId, tenantKey);
// List<AddUpDeduction> 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<String, Object> onlineRequest(AddUpDeductionMonthTaxAgentParam param) {
SalaryAssert.notNull(param.getDeclareMonth(), SalaryI18nUtil.getI18nLabel(100586, "税款所属期必传"));
// 获取接口配置
TaxDeclarationApiConfigPO apiConfig = getTaxDeclarationApiConfigService(user).getConfig(true);
// 获取包装类
AddUpDeductionOnlineRequestWrapper requestWrapper = getAddUpDeductionOnlineRequestWrapper(null, apiConfig);
// 获取报税信息
List<TaxAgentTaxReturnPO> taxReturnPOList = getTaxAgentTaxReturnService(user).getByTaxAgentIds(requestWrapper.getTaxAgentMap().keySet());
List<TaxAgentTaxReturnPO> failReturnPOList = taxReturnPOList.stream().filter(e -> !TaxAgentTaxReturnStatusEnum.SUCCESS.getValue().equals(e.getCheckStatus())).collect(Collectors.toList());
SalaryAssert.isFalse(taxReturnPOList.size() == failReturnPOList.size(), SalaryI18nUtil.getI18nLabel(183781, "企业未通过验证,暂时无法获取累计专项附加扣除数据,请先在【个税扣缴义务人】菜单验证企业报税信息"));
Map<String, Object> 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<AddUpDeductionRequestPO> requestPOList = getAddUpDeductionRequestPOS();
SalaryAssert.isEmpty(requestPOList, SalaryI18nUtil.getI18nLabel(153341, "获取中,稍后请点击【获取结果下载】"));
// 获取报送成功的人员名单
Map<Long, List<EmployeeDeclarePO>> taxAgentEmpDeclareMap = getEmpDeclareMap(requestWrapper.getTaxAgentMap().keySet(), param.getDeclareMonth());
// 开始请求接口获取数据
List<QuerySpecialAmountResponse.Body> querySpecialAmountBodies = getQuerySpecialAmountBodies(param, requestWrapper, taxAgentEmpDeclareMap, taxReturnPOList);
// 持久化数据
persistFeedbackData(param, querySpecialAmountBodies);
return result;
}
private AddUpDeductionOnlineRequestWrapper getAddUpDeductionOnlineRequestWrapper(List<AddUpDeductionRequestPO> requestPOList, TaxDeclarationApiConfigPO apiConfig) {
boolean isOpenDevolution = getTaxAgentService(user).isOpenDevolution();
long employeeId = (long) user.getUID();
boolean isChief = getTaxAgentService(user).isChief(employeeId);
List<TaxAgentPO> taxAgents = !isOpenDevolution || isChief ? getTaxAgentService(user).listAll() : (List<TaxAgentPO>) getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId);
List<Long> taxAgentIdSet = SalaryEntityUtil.properties(taxAgents, TaxAgentPO::getId, Collectors.toList());
// 获取薪资档案
List<SalaryArchivePO> 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<Long, List<EmployeeDeclarePO>> getEmpDeclareMap(Collection<Long> taxAgentIds, Date declareMonth) {
List<EmployeeDeclarePO> employeeDeclarePOS = getEmployeeDeclarePOList(taxAgentIds, declareMonth);
SalaryAssert.notEmpty(employeeDeclarePOS, SalaryI18nUtil.getI18nLabel(183783, "暂无人员报送状态为正常的数据,请先报送再获取累计专项附加扣除数据。"));
return employeeDeclarePOS.stream().collect(Collectors.groupingBy(EmployeeDeclarePO::getTaxAgentId));
}
private List<EmployeeDeclarePO> getEmployeeDeclarePOList(Collection<Long> taxAgentIds, Date declareMonth) {
return getEmployeeDeclareMapper().listSome(EmployeeDeclarePO.builder().declareStatus(DeclareStatusEnum.DECLARE_SUCCESS.getValue()).taxCycle(declareMonth).taxAgentIds(taxAgentIds).build());
}
private List<QuerySpecialAmountResponse.Body> getQuerySpecialAmountBodies(AddUpDeductionMonthTaxAgentParam param,
AddUpDeductionOnlineRequestWrapper requestWrapper,
Map<Long, List<EmployeeDeclarePO>> taxAgentEmployeeDeclareMap,
List<TaxAgentTaxReturnPO> taxReturnPOList) {
List<QuerySpecialAmountResponse.Body> queryResponseList = new ArrayList<>();
for (TaxAgentTaxReturnPO returnPO : taxReturnPOList) {
if (!TaxAgentTaxReturnStatusEnum.SUCCESS.getValue().equals(returnPO.getCheckStatus())) {
continue;
}
// 发起请求
String taxAgentName = requestWrapper.getTaxAgentMap().get(returnPO.getTaxAgentId());
List<EmployeeDeclarePO> 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<QuerySpecialAmountResponse.Body> 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<EmployeeDeclarePO> declarePOList,
AddUpDeductionMonthTaxAgentParam param,
TaxDeclarationApiConfigPO apiConfig) {
String url = apiConfig.getHost() + SzyhApiConstant.QUERY_SPECIAL_AMOUNT;
Map<String, Object> 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<String, String> params = new HashMap<>(1);
Map<String, String> 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<AddUpDeductionRequestPO> 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);
// 获取已存在的累计附加扣除数据
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<AddUpDeductionRequestFailListDTO> onlineFeedbackFail(AddUpDeductionRequestFailQueryParam queryParam) {
List<AddUpDeductionRequestFailPO> addUpDeductionRequestFailPOS = getAddUpDeductionRequestFailMapper().listSome(AddUpDeductionRequestFailPO.builder().requestId(queryParam.getRequestId()).build());
List<AddUpDeductionRequestFailPO> list = SalaryPageUtil.subList(queryParam.getCurrent(), queryParam.getPageSize(), addUpDeductionRequestFailPOS);
// 获取薪资档案
AddUpDeductionOnlineRequestWrapper requestWrapper = getAddUpDeductionOnlineRequestWrapper(null, null);
this.getEmployeeInfoMap(requestWrapper);
List<AddUpDeductionRequestFailListDTO> listDTOList = list.stream().map(requestWrapper::buildAddUpDeductionRequestFailListDTO).collect(Collectors.toList());
PageInfo<AddUpDeductionRequestFailListDTO> page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), listDTOList, AddUpDeductionRequestFailListDTO.class);
page.setTotal(addUpDeductionRequestFailPOS.size());
return page;
}
@Override
public List<AddUpDeductionRequestFailPO> getAddUpDeductionRequestFailPOList(Long requestId) {
return getAddUpDeductionRequestFailMapper().listSome(AddUpDeductionRequestFailPO.builder().requestId(requestId).build());
}
@Override
public XSSFWorkbook exportOnlineFeedbackFail( Long requestId) {
List<List<Object>> rows = new ArrayList<>();
// 表头
List<Object> headers = new ArrayList<>();
headers.add(SalaryI18nUtil.getI18nLabel(85429, "姓名"));
headers.add(SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"));
headers.add(SalaryI18nUtil.getI18nLabel(86317, "工号"));
headers.add(SalaryI18nUtil.getI18nLabel(86185, "部门"));
headers.add(SalaryI18nUtil.getI18nLabel(106277, "身份证号码"));
headers.add(SalaryI18nUtil.getI18nLabel(144832, "失败原因"));
rows.add(headers);
// 获取薪资档案
AddUpDeductionOnlineRequestWrapper requestWrapper = getAddUpDeductionOnlineRequestWrapper(null, null);
// 获取身份信息map
this.getEmployeeInfoMap(requestWrapper);
// 获取数据
List<AddUpDeductionRequestFailPO> pos = getAddUpDeductionRequestFailPOList(requestId);
// 组装数据
for (AddUpDeductionRequestFailPO po : pos) {
AddUpDeductionRequestFailListDTO failListDTO = requestWrapper.buildAddUpDeductionRequestFailListDTO(po);
List<Object> 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, "在线获取专项附加扣除失败数据");
}
private void getEmployeeInfoMap(AddUpDeductionOnlineRequestWrapper wrapper) {
// 身份证号
List<Long> employeeIds = SalaryEntityUtil.properties(wrapper.getSalaryArchiveList(), SalaryArchivePO::getEmployeeId, Collectors.toList());
List<DataCollectionEmployee> simpleUserInfos = getSalaryEmployeeService(user).listByIds(employeeIds);
Map<Long, DataCollectionEmployee> simpleUserInfoMap = SalaryEntityUtil.convert2Map(simpleUserInfos, DataCollectionEmployee::getEmployeeId);
wrapper.setUserInfoUserIdMap(simpleUserInfoMap);
// 人员信息
List<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).listAll(UseEmployeeTypeEnum.ALL);
Map<Long, DataCollectionEmployee> simpleEmployeeMap = SalaryEntityUtil.convert2Map(simpleEmployees, DataCollectionEmployee::getEmployeeId);
wrapper.setSimpleEmployeeMap(simpleEmployeeMap);
// 外部人员信息
List<ExtEmpPO> extEmployeePOS = getExtEmpService(user).listAll();
Map<Long, ExtEmpPO> extEmployeePOMap = SalaryEntityUtil.convert2Map(extEmployeePOS, ExtEmpPO::getId, e -> e);
wrapper.setExtEmployeePOMap(extEmployeePOMap);
}
private List<AddUpDeductionRequestPO> 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<AddUpDeductionRequestPO> requestPOList) {
Map<Integer, List<AddUpDeductionRequestPO>> statusRequestMap = SalaryEntityUtil.group2Map(requestPOList, AddUpDeductionRequestPO::getRequestStatus);
if (CollectionUtils.isEmpty(statusRequestMap.get(EnumAddUpDeductionRequestStatus.RUNNING.getValue()))) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(153343, "请先点击【在线获取】按钮,选择税款所属期进行获取数据。"));
}
Set<Long> 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<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).listAll(UseEmployeeTypeEnum.ORG);
Map<Long, DataCollectionEmployee> simpleEmployeeMap = SalaryEntityUtil.convert2Map(simpleEmployees, DataCollectionEmployee::getEmployeeId);
requestWrapper.setSimpleEmployeeMap(simpleEmployeeMap);
// 内部员工身份证信息
List<Long> employeeIds = SalaryEntityUtil.properties(requestWrapper.getSalaryArchiveList(), SalaryArchivePO::getEmployeeId, Collectors.toList());
List<DataCollectionEmployee> simpleUserInfos = getSalaryEmployeeService(user).listByIds(employeeIds);
Map<String, DataCollectionEmployee> simpleUserInfoMap = SalaryEntityUtil.convert2Map(simpleUserInfos, DataCollectionEmployee::getIdNo);
requestWrapper.setUserInfoIdNoMap(simpleUserInfoMap);
// 外部员工信息
List<ExtEmpPO> extEmployeePOS = getExtEmpService(user).listAll();
Map<String, Long> extEmployeePOMap = SalaryEntityUtil.convert2Map(extEmployeePOS, ExtEmpPO::getIdNo, ExtEmpPO::getId);
requestWrapper.setExtEmployeeIdCardMap(extEmployeePOMap);
}
private void setExistedDataMap(AddUpDeductionOnlineRequestWrapper requestWrapper) {
List<Long> taxAgentIds = SalaryEntityUtil.properties(requestWrapper.getSalaryArchiveList(), SalaryArchivePO::getTaxAgentId, Collectors.toList());
List<AddUpDeduction> 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<QuerySpecialAmountFeedbackResponse.Feedback> 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<List<AddUpDeduction>> insertPartition = Lists.partition(requestWrapper.getInsertList(), 100);
insertPartition.forEach(list -> {
list = encryptUtil.encryptList(list, AddUpDeduction.class);
getAddUpDeductionMapper().insertData(list);
});
}
if (!requestWrapper.getUpdateList().isEmpty()) {
List<List<AddUpDeduction>> updatePartition = Lists.partition(requestWrapper.getUpdateList(), 100);
updatePartition.forEach(list -> {
list = encryptUtil.encryptList(list, AddUpDeduction.class);
getAddUpDeductionMapper().updateData(list);
});
}
if (!requestWrapper.getFailPOList().isEmpty()) {
List<List<AddUpDeductionRequestFailPO>> 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<AddUpDeductionRequestPO> 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<String, String> params = new HashMap<>(1);
params.put("requestId", requestPO.getOuterRequestId());
Map<String, String> 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;
// 单次请求对应的反馈数据map
private Map<String, List<QuerySpecialAmountFeedbackResponse.Feedback>> requestFeedBackMap;
private Map<String, AddUpDeductionRequestPO> requestPoMap;
// 查询薪资档案定薪待停薪停薪
private List<SalaryArchivePO> salaryArchiveList;
private Map<Long, String> taxAgentMap;
// 员工信息map(身份证号 -> 员工ID)
private Map<String, DataCollectionEmployee> userInfoIdNoMap;
// 员工信息map(员工ID -> 身份证)
private Map<Long, DataCollectionEmployee> userInfoUserIdMap;
// 员工详细信息map(key = 员工ID)
private Map<Long, DataCollectionEmployee> simpleEmployeeMap;
// 获取当前库中累计附加扣除的数据
private Map<String, Long> existedDataMap;
// 需要新增的数据
private List<AddUpDeduction> insertList;
// 需要更新的数据
private List<AddUpDeduction> updateList;
// 失败数据分页
private List<AddUpDeductionRequestFailListDTO> failDTOList;
// 失败数据持久化
private List<AddUpDeductionRequestFailPO> failPOList;
// 请求详细信息列表
private List<AddUpDeductionRequestPO> requestPOList;
// 外部人员(身份证 -> id)
private Map<String, Long> extEmployeeIdCardMap;
// 外部人员(id -> 实体)
private Map<Long, ExtEmpPO> extEmployeePOMap;
// api配置
private TaxDeclarationApiConfigPO apiConfig;
public AddUpDeductionOnlineRequestWrapper(List<AddUpDeductionRequestPO> requestPOList,
List<SalaryArchivePO> salaryArchiveList,
List<TaxAgentPO> 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;
}
}
}

View File

@ -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<String, Object> getSearchCondition() {
Map<String, Object> apidatas = new HashMap<String, Object>();
@ -273,8 +298,8 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
long employeeId = user.getUID();
// excel标题
final List<String> title = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "入职日期", "累计收入额", "累计减除费用",
"累计社保个人合计", "累计公积金个人合计", "累计子女教育", "累计继续教育", "累计住房贷款利息", "累计住房租金", "累计赡养老人",
"累计大病医疗", "累计企业(职业)年金及其他福利", "累计其他扣除", "累计免税收入", "累计准予扣除的捐赠额", "累计减免税额", "累计已预扣预缴税额", "累计婴幼儿照护","累计个人养老金");
"累计社保个人合计", "累计公积金个人合计", "累计企业(职业)年金及其他福利", "累计其他扣除", "累计免税收入", "累计准予扣除的捐赠额", "累计减免税额",
"累计已预扣预缴税额", "实际累计已预扣预缴税额", "个税调差", "累计应纳税所得额");
//排序配置
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<List<String>> getExcelRowDetailList(AddUpSituationQueryParam param) {
long employeeId = user.getUID();
//excel标题
List<String> title = Arrays.asList("姓名", "税款所属期", "个税扣缴义务人", "部门", "手机号", "工号", "累计收入额", "累计减除费用", "累计社保个人合计",
"累计公积金个人合计", "累计子女教育", "累计继续教育", "累计住房贷款利息", "累计住房租金", "累计赡养老人", "累计大病医疗", "累计企业(职业)年金及其他福利",
"累计其他扣除", "累计免税收入", "累计准予扣除的捐赠额", "累计减免税额", "累计已预扣预缴税额", "累计婴幼儿照护","累计个人养老金");
List<String> title = Arrays.asList("姓名", "税款所属期", "个税扣缴义务人", "部门", "手机号", "工号", "累计收入额", "累计减除费用",
"累计社保个人合计", "累计公积金个人合计", "累计企业(职业)年金及其他福利", "累计其他扣除", "累计免税收入", "累计准予扣除的捐赠额", "累计减免税额",
"累计已预扣预缴税额", "实际累计已预扣预缴税额", "个税调差", "累计应纳税所得额");
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, "累计其他免税扣除"),
SalaryI18nUtil.getI18nLabel(86704, "累计免税收入"),
SalaryI18nUtil.getI18nLabel(86703, "累计准予扣除的捐赠额"),
SalaryI18nUtil.getI18nLabel(105478, "累计减免税额"),
SalaryI18nUtil.getI18nLabel(86702, "累计已预扣预缴税额"),
SalaryI18nUtil.getI18nLabel(86702, "累计婴幼儿照护"),
SalaryI18nUtil.getI18nLabel(86702, "累计个人养老金")
SalaryI18nUtil.getI18nLabel(86702, "实际累计已预扣预缴税额"),
SalaryI18nUtil.getI18nLabel(86702, "个税调差"),
SalaryI18nUtil.getI18nLabel(86702, "累计应纳税所得额")
};
// 2.表头
List<Object> 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<AddUpSituationDTO> excelDates = ExcelParseHelper.parse2Map(fileInputStream, AddUpSituationDTO.class, 0, 1, 25, "template.xlsx");
List<AddUpSituationDTO> 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<AddUpSituationDTO> excelDates = ExcelParseHelper.parse2Map(fileInputStream, AddUpSituationDTO.class, 0, 1, 25, "template.xlsx");
List<AddUpSituationDTO> 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<SalaryAcctEmployeePO> 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());
//实际累计已预扣预缴税额
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<TaxAgentManageRangeEmployeeDTO> 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<SalaryAcctEmployeePO> 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<SalaryAcctEmployeePO> 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 分权判断若员工离职后不在扣缴义务人范围内会有异常
// fixme 分权判断若员工离职后不在扣缴义务人范围内会有异常
// if (openDevolution) {
// Optional<TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee> 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());
//实际累计已预扣预缴税额
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<SalaryAcctEmployeePO> salaryAcctEmployees = getAddUpDeductionService(user).getAccountedEmployeeData(format);
// 判断是否有核算过
List<Long> deleteList = new ArrayList<>();
for(int i=0; i<deleteIds.size(); i++){
for (int i = 0; i < deleteIds.size(); i++) {
Long id = deleteIds.get(i);
AddUpSituation byId = biz.getById(id);
if(byId == null){
if (byId == null) {
throw new SalaryRunTimeException("数据不存在或已被删除!");
}
// 判断是否在个税扣缴义务人范围内
Optional<TaxAgentManageRangeEmployeeDTO> first = taxAgentList.stream().filter(m -> Objects.equals(m.getTaxAgentId() , byId.getTaxAgentId())).findFirst();
if(!first.isPresent()){
Optional<TaxAgentManageRangeEmployeeDTO> first = taxAgentList.stream().filter(m -> Objects.equals(m.getTaxAgentId(), byId.getTaxAgentId())).findFirst();
if (!first.isPresent()) {
throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内");
}
// 判断用户是否存在
@ -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("个税扣缴义务人不存在或不在权限范围内!");
}
ArrayList<Long> 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<SalaryAcctEmployeePO> employees = getAddUpDeductionService(user).getAccountedEmployeeData(format);
for(AddUpSituation item : list){
for (AddUpSituation item : list) {
if (CollectionUtils.isNotEmpty(employees)) {
Optional<SalaryAcctEmployeePO> 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<AddUpSituationRecordDTO> 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<AddUpSituation> list) {
if (CollectionUtils.isNotEmpty(list)) {
list = encryptUtil.encryptList(list,AddUpSituation.class);
list = encryptUtil.encryptList(list, AddUpSituation.class);
List<List<AddUpSituation>> partition = Lists.partition(list, 50);
partition.forEach(getAddUpSituationMapper()::insertData);
}
}
@Override
public Map<String, Object> onlineRequest(AddUpDeductionMonthTaxAgentParam param) {
SalaryAssert.notNull(param.getDeclareMonth(), SalaryI18nUtil.getI18nLabel(100586, "税款所属期必传"));
// 获取接口配置
TaxDeclarationApiConfigPO apiConfig = getTaxDeclarationApiConfigService(user).getConfig(true);
// 获取包装类
AddUpDeductionServiceImpl.AddUpDeductionOnlineRequestWrapper requestWrapper = getAddUpDeductionOnlineRequestWrapper(null, apiConfig);
// 获取报税信息
List<TaxAgentTaxReturnPO> taxReturnPOList = getTaxAgentTaxReturnService(user).getByTaxAgentIds(requestWrapper.getTaxAgentMap().keySet());
List<TaxAgentTaxReturnPO> failReturnPOList = taxReturnPOList.stream().filter(e -> !TaxAgentTaxReturnStatusEnum.SUCCESS.getValue().equals(e.getCheckStatus())).collect(Collectors.toList());
SalaryAssert.isFalse(taxReturnPOList.size() == failReturnPOList.size(), SalaryI18nUtil.getI18nLabel(183781, "企业未通过验证,暂时无法获取累计专项附加扣除数据,请先在【个税扣缴义务人】菜单验证企业报税信息"));
Map<String, Object> 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<Long, List<EmployeeDeclarePO>> taxAgentEmpDeclareMap = getEmpDeclareMap(requestWrapper.getTaxAgentMap().keySet(), param.getDeclareMonth());
// 开始请求接口获取数据
getQuerySpecialAmountBodies(param, requestWrapper, taxAgentEmpDeclareMap, taxReturnPOList);
return result;
}
private void getQuerySpecialAmountBodies(AddUpDeductionMonthTaxAgentParam param,
AddUpDeductionServiceImpl.AddUpDeductionOnlineRequestWrapper requestWrapper,
Map<Long, List<EmployeeDeclarePO>> taxAgentEmployeeDeclareMap,
List<TaxAgentTaxReturnPO> taxReturnPOList) {
List<AddUpSituation> updateList = new ArrayList<>();
List<AddUpSituation> insertList = new ArrayList<>();
for (TaxAgentTaxReturnPO returnPO : taxReturnPOList) {
if (!TaxAgentTaxReturnStatusEnum.SUCCESS.getValue().equals(returnPO.getCheckStatus())) {
continue;
}
// 发起请求
String taxAgentName = requestWrapper.getTaxAgentMap().get(returnPO.getTaxAgentId());
List<EmployeeDeclarePO> declarePOList = taxAgentEmployeeDeclareMap.getOrDefault(returnPO.getTaxAgentId(), new ArrayList<>());
if (declarePOList.isEmpty()) {
log.info("该主体下没有报送成功的人员,主体名称:{}", taxAgentName);
continue;
}
List<AddUpSituation> poList = getAddUpSituationMapper().listSome((AddUpSituation.builder().taxYearMonth(param.getDeclareMonth()).taxAgentId(returnPO.getTaxAgentId()).build()));
encryptUtil.decryptList(poList,AddUpSituation.class);
Map<String, AddUpSituation> poMap = SalaryEntityUtil.convert2Map(poList, e -> e.getTaxAgentId() + "-" + e.getEmployeeId());
// 内部员工身份证信息
List<Long> employeeIds = SalaryEntityUtil.properties(requestWrapper.getSalaryArchiveList(), SalaryArchivePO::getEmployeeId, Collectors.toList());
List<DataCollectionEmployee> simpleUserInfos = getSalaryEmployeeService(user).listByIds(employeeIds);
Map<String, DataCollectionEmployee> 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<GetCompanyIncomesResponse.Detail> 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<List<AddUpSituation>> insertPartition = Lists.partition(insertList, 50);
insertPartition.forEach(list -> {
list = encryptUtil.encryptList(list, AddUpSituation.class);
getAddUpSituationMapper().insertData(list);
});
}
if (!updateList.isEmpty()) {
List<List<AddUpSituation>> 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<String, Object> 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<String, String> params = new HashMap<>(1);
Map<String, String> 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<AddUpDeductionRequestPO> requestPOList, TaxDeclarationApiConfigPO apiConfig) {
boolean isOpenDevolution = getTaxAgentService(user).isOpenDevolution();
boolean isChief = getTaxAgentService(user).isChief((long) user.getUID());
List<TaxAgentPO> taxAgents = !isOpenDevolution || isChief ? getTaxAgentService(user).listAll() : (List<TaxAgentPO>) getTaxAgentService(user).listAllTaxAgentsAsAdmin((long) user.getUID());
Set<Long> taxAgentIdSet = SalaryEntityUtil.properties(taxAgents, TaxAgentPO::getId);
// 获取薪资档案
List<SalaryArchivePO> 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<Long, List<EmployeeDeclarePO>> getEmpDeclareMap(Collection<Long> taxAgentIds, Date declareMonth) {
List<EmployeeDeclarePO> employeeDeclarePOS = getEmployeeDeclarePOList(taxAgentIds, declareMonth);
SalaryAssert.notEmpty(employeeDeclarePOS, SalaryI18nUtil.getI18nLabel(183783, "暂无人员报送状态为正常的数据,请先报送再获取往期累计数据。"));
return employeeDeclarePOS.stream().collect(Collectors.groupingBy(EmployeeDeclarePO::getTaxAgentId));
}
private List<EmployeeDeclarePO> getEmployeeDeclarePOList(Collection<Long> taxAgentIds, Date declareMonth) {
return getEmployeeDeclareMapper().listSome(EmployeeDeclarePO.builder().declareStatus(DeclareStatusEnum.DECLARE_SUCCESS.getValue()).taxCycle(declareMonth).taxAgentIds(taxAgentIds).build());
}
}

View File

@ -183,82 +183,80 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
formulaVarValues.addAll(empInfo);
Map<String, String> formulaVarValueMap = SalaryEntityUtil.convert2Map(formulaVarValues, CalculateFormulaVarBO.FormulaVarValue::getFieldId, CalculateFormulaVarBO.FormulaVarValue::getFieldValue);
// 按照计算好的优先级计算薪资项目的值
for (List<Long> 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);
}
// 处理薪资档案
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)) {
// 转换成薪资核算结果po
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);
}
// 处理薪资档案
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)) {
// 转换成薪资核算结果po
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);
}
}
}

View File

@ -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
// 转换成po
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<SalaryAcctTaxAgentPO> 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<SalaryAcctRecordPO> 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<SalaryAcctTaxAgentPO> 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<SalaryAcctTaxAgentPO> salaryAcctTaxAgents) {
salaryAcctTaxAgents = salaryAcctTaxAgents.stream()
.filter(e -> Objects.equals(e.getIncomeCategory(), IncomeCategoryEnum.ONETIME_ANNUAL_BONUS.getValue()))
.collect(Collectors.toList());
if (CollectionUtils.isEmpty(salaryAcctTaxAgents)) {
return;
}
// 查询本次薪资核算记录的税款所属期所在年度的薪资核算记录
Set<Integer> sameYearSet = Sets.newHashSet();
List<SalaryAcctTaxAgentPO> 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<SalaryAcctTaxAgentPO> salaryAcctTaxAgents) {
// 排除掉所得项目为全年一次性奖金收入的薪资核算记录
salaryAcctTaxAgents = salaryAcctTaxAgents.stream()
.filter(e -> !Objects.equals(e.getIncomeCategory(), IncomeCategoryEnum.ONETIME_ANNUAL_BONUS.getValue()))
.collect(Collectors.toList());
Set<Integer> sameYearSet = Sets.newHashSet();
List<TaxDeclarationPO> sameYearTaxDeclarations = Lists.newArrayList();
List<SalaryAcctTaxAgentPO> 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());
// 查询个税扣缴义务人
Set<Long> taxAgentIds = SalaryEntityUtil.properties(salaryAcctTaxAgents, SalaryAcctTaxAgentPO::getTaxAgentId);
List<TaxAgentPO> taxAgents = getTaxAgentService(user).listByIds(taxAgentIds);
Map<Long, String> taxAgentMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgentPO::getId, TaxAgentPO::getName);
Set<String> declareTaxAgents = SalaryEntityUtil.properties(sameYearTaxDeclarations, e -> e.getTaxAgentId() + "-" + e.getTaxCycle());
Map<Long, List<SalaryAcctTaxAgentPO>> sameYearSalaryAcctTaxAgentMap = SalaryEntityUtil
.group2Map(sameYearSalaryAcctTaxAgents, SalaryAcctTaxAgentPO::getTaxAgentId);
for (SalaryAcctTaxAgentPO salaryAcctTaxAgent : salaryAcctTaxAgents) {
List<SalaryAcctTaxAgentPO> 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, "个税扣缴义务人「{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, "个税扣缴义务人「{0}」已经存在薪资所属月「{1}」的薪资核算记录了,无法新建薪资所属月「{2}」的薪资核算")
.replace("{0}", taxAgentMap.get(calculatedSalaryAcctTaxAgent.getTaxAgentId()))
.replace("{1}", SalaryDateUtil.getFormatYYYYMM(calculatedSalaryAcctTaxAgent.getSalaryMonth()))
.replace("{2}", SalaryDateUtil.getFormatYYYYMM(salaryAcctTaxAgent.getSalaryMonth())));
}
}
}
private List<SalaryAcctRecordPO> listByCreateDate(LocalDateRange taxCycleRebootYearRange, Set<Long> 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<SalaryAcctRecordPO> loggerContext = new LoggerContext<>();
// loggerContext.setTargetId("" + salaryAcctRecordPO.getId());
// loggerContext.setTargetName(targetName);

View File

@ -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;
/**
* 薪资核算结果
* <p>Copyright: Copyright (c) 2022</p>
@ -331,7 +338,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
List<SalarySobItemPO> salarySobItemPOS = getSalarySobItemService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
Map<Long, SalarySobItemPO> salaryItemIdKeySalarySobItemPOMap = SalaryEntityUtil.convert2Map(salarySobItemPOS, SalarySobItemPO::getSalaryItemId);
Set<Long> salaryItemIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getSalaryItemId);
if(Objects.equals(salaryAcctRecordPO.getBackCalcStatus(), NumberUtils.INTEGER_ONE)){
if (Objects.equals(salaryAcctRecordPO.getBackCalcStatus(), NumberUtils.INTEGER_ONE)) {
// 是回算获取回算项
List<SalarySobBackItemPO> 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<SalaryItemPO> salaryItemPOS = getSalaryItemService(user).listByIds(salaryItemIds);
// 查询薪资核算结果
List<Long> salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId,Collectors.toList());
List<Long> salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId, Collectors.toList());
List<SalaryAcctResultPO> salaryAcctResultPOS = listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds);
Map<String, Object> map = new HashMap<>();
@ -396,7 +403,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
}
List<SalaryItemPO> salaryItemPOS = getSalaryItemService(user).listByIds(salaryItemIds);
// 查询薪资核算结果
List<Long> salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId,Collectors.toList());
List<Long> salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId, Collectors.toList());
List<SalaryAcctResultPO> salaryAcctResultPOS = listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds);
// 查询人员信息
List<Long> 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<Long> salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId,Collectors.toList());
List<Long> salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId, Collectors.toList());
List<SalaryAcctResultPO> salaryAcctResultPOS = listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds);
// 查询薪资核算人员所有合并计税的薪资核算记录所用的账套
Set<Long> salarySobIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getSalarySobId);
@ -555,13 +562,13 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
// 保存参数转换成薪资核算结果po
List<SalaryAcctResultPO> 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<Long> needLockItems = new HashSet<>();
Map<Long, SalaryAcctResultPO> 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);
// 查询操作日志的targetName
// 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<SalaryAcctResultPO> editItems = new ArrayList<>();
Map<Long, SalaryAcctResultPO> 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<ExpressFormula> expressFormulas = getSalaryFormulaService(user).listExpressFormula(formulaIds);
// 本次运算的回算薪资项目所涉及的变量
Set<String> issuedFieldIds = new HashSet<>();
Set<String> issuedFieldIds = getIssuedFieldIds(salarySobBackItems);
// 9计算薪资项目的运算优先级
List<List<Long>> salarySobItemsWithPriority = SalaryAcctCalculatePriorityBO.calculatePriority(salarySobItemPOS, salaryItemPOS, expressFormulas, salarySobBackItems, issuedFieldIds);
// List<List<Long>> salarySobItemsWithPriority = SalaryAcctCalculatePriorityBO.calculatePriority(salarySobItemPOS, salaryItemPOS, expressFormulas, salarySobBackItems, issuedFieldIds);
List<Long> salarySobItemsWithPriority = sortItems(salarySobItemPOS, salarySobBackItems, salaryItemPOS, expressFormulas);
// 10根据id查询其他合并计税的薪资核算记录
List<SalaryAcctRecordPO> otherSalaryAcctRecordPOS = getSalaryAcctRecordService(user).listById4OtherConsolidatedTax(salaryAcctRecordPO.getId());
// 11查询本次核算人员
@ -819,8 +829,8 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
List<Long> 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<Long> sortItems(List<SalarySobItemPO> salarySobItemPOS, List<SalarySobBackItemPO> salarySobBackItems, List<SalaryItemPO> salaryItemPOS, List<ExpressFormula> expressFormulas) {
List<SalarySobItemPO> 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<SalaryCalcItem> salaryCalcItems = salaryCalcItemGraph.sort();
return SalaryEntityUtil.properties(salaryCalcItems, SalaryCalcItem::getSalaryItemId, Collectors.toList());
}
/**
* 获取回算变量
*
* @param salarySobBackItems
* @return
*/
@NotNull
private Set<String> getIssuedFieldIds(List<SalarySobBackItemPO> salarySobBackItems) {
Set<String> issuedFieldIds;
Set<Long> issuedFormulaIds = SalaryEntityUtil.properties(salarySobBackItems, SalarySobBackItemPO::getFormulaId);
List<ExpressFormula> expressFormulas1 = getSalaryFormulaService(user).listExpressFormula(issuedFormulaIds);
List<FormulaVar> 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<Long> 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<SalaryAcctResultPO> listByAcctEmployeeIdsAndSalaryItemIds(List<Long> salaryAcctEmployeeIds, Collection<Long> salaryItemIds) {
if(CollectionUtils.isEmpty(salaryAcctEmployeeIds)){
if (CollectionUtils.isEmpty(salaryAcctEmployeeIds)) {
return Collections.emptyList();
}
List<List<Long>> partition = Lists.partition((List<Long>)salaryAcctEmployeeIds, 200);
List<List<Long>> partition = Lists.partition((List<Long>) salaryAcctEmployeeIds, 200);
List<SalaryAcctResultPO> 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<Long> listAcctEmpIdByAcctEmpId(List<Long> salaryAcctEmployeeIds) {
if(CollectionUtils.isEmpty(salaryAcctEmployeeIds)){
if (CollectionUtils.isEmpty(salaryAcctEmployeeIds)) {
return Collections.emptyList();
}
List<List<Long>> partition = Lists.partition((List<Long>)salaryAcctEmployeeIds, 1000);
List<List<Long>> partition = Lists.partition((List<Long>) salaryAcctEmployeeIds, 1000);
List<Long> 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) {
// 获取该核算记录的个税扣缴义务
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<TaxAgentAdminPO> adminTaxAgentList = getTaxAgentAdminService(user).listByEmployeeId(Long.valueOf(user.getUID()));
Optional<TaxAgentAdminPO> canOperate = adminTaxAgentList.stream().filter(po -> NumberUtils.compare(taxAgentId, po.getTaxAgentId()) == 0).findFirst();
if(!canOperate.isPresent()){
return false;
if (!canOperate.isPresent()) {
return false;
}
return true;
}

View File

@ -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<SalaryAcctTaxAgentPO> listBySalaryAcctRecordIds(Collection<Long> salaryAcctRecordIds) {
if (CollectionUtils.isEmpty(salaryAcctRecordIds)) {
return Collections.emptyList();
}
return getSalaryAcctTaxAgentMapper().listAcctTaxAgent(salaryAcctRecordIds);
}
@Override
public List<SalaryAcctTaxAgentPO> 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<SalaryAcctTaxAgentPO> listBySalaryAcctRecordIds(Collection<Long> 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<SalaryAcctTaxAgentPO> listByTaxCycleRange(YearMonthRange taxCycleRange, String tenantKey) {
// LambdaQueryWrapper<SalaryAcctTaxAgentPO> 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<SalaryAcctTaxAgentPO> initBySalaryAcctEmployees(List<SalaryAcctEmployeePO> salaryAcctEmployees, Long employeeId, String tenantKey) {
// public List<SalaryAcctTaxAgentPO> initBySalaryAcctEmployees(List<SalaryAcctEmployeePO> salaryAcctEmployees) {
// if (CollectionUtils.isEmpty(salaryAcctEmployees)) {
// return Collections.emptyList();
// }
@ -89,19 +69,18 @@
// }
//
// @Override
// @Transactional(rollbackFor = Exception.class)
// public void batchSave(List<SalaryAcctTaxAgentPO> salaryAcctTaxAgents, String tenantKey) {
// public void batchSave(List<SalaryAcctTaxAgentPO> salaryAcctTaxAgents) {
// if (CollectionUtils.isNotEmpty(salaryAcctTaxAgents)) {
// saveBatch(salaryAcctTaxAgents);
// }
// }
//
// @Override
// public void deleteBySalaryAcctRecordIds(Collection<Long> salaryAcctRecordIds, String tenantKey) {
// public void deleteBySalaryAcctRecordIds(Collection<Long> 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();
// }
//}
}

View File

@ -1328,4 +1328,9 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
}
return result;
}
@Override
public List<SalaryArchivePO> listByRunStatus(List<String> list) {
return getSalaryArchiveMapper().listSome(SalaryArchivePO.builder().runStatusList(list).build());
}
}

View File

@ -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;
}

View File

@ -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<TaxDeclarationPO> listByTaxCycleRange(YearMonthRange yearMonthRange) {
return getTaxDeclarationMapper().listSome(TaxDeclarationPO.builder()
.salaryMonths(LocalDateRange.builder().fromDate(yearMonthRange.getStartMonth()).endDate(yearMonthRange.getEndMonth()).build())
.build());
}
}

View File

@ -32,7 +32,7 @@ import java.util.*;
import java.util.stream.Collectors;
/**
* 个税申报表
* 个税申报表
* <p>Copyright: Copyright (c) 2023</p>
* <p>Company: 泛微软件</p>
*
@ -92,7 +92,7 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar
List<EmployeeDeclarePO> employeeDeclares = getEmployeeDeclareService(user).listByTaxCycleAndTaxAgentIdAndEmployeeIds(taxDeclaration.getTaxCycle(), taxDeclaration.getTaxAgentId(), employeeIds);
// 查询人员信息
List<Long> 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());

View File

@ -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<SalaryAcctEmployeePO> salaryAcctEmployees) {

View File

@ -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 新建累计专项附加扣除
* @return String
* @description 新建累计专项附加扣除
* @author Harryxzy
* @date 2022/10/26 14:23
*/
@ -285,8 +284,8 @@ public class AddUpDeductionController {
}
/**
* @description 获取累计专项附加扣除信息
* @return String
* @description 获取累计专项附加扣除信息
* @author Harryxzy
* @date 2022/10/31 11:23
*/
@ -300,8 +299,8 @@ public class AddUpDeductionController {
/**
* @description 编辑累计专项附加扣除
* @return String
* @description 编辑累计专项附加扣除
* @author Harryxzy
* @date 2022/10/25 14:08
*/
@ -314,8 +313,8 @@ public class AddUpDeductionController {
}
/**
* @description 累计专项附加扣除-删除所选
* @return String
* @description 累计专项附加扣除-删除所选
* @author Harryxzy
* @date 2022/10/27 14:08
*/
@ -328,8 +327,8 @@ public class AddUpDeductionController {
}
/**
* @description 累计专项附加扣除-一键清空
* @return String
* @description 累计专项附加扣除-一键清空
* @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<Date, String>(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<AddUpDeductionMonthTaxAgentParam, Map<String, Object>>(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<AddUpDeductionMonthTaxAgentParam, AddUpDeductionRequestResultDTO>(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<AddUpDeductionRequestFailQueryParam, PageInfo<AddUpDeductionRequestFailListDTO>>(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 = "在线获取专项附加扣除失败数据" + 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);
// }
}

View File

@ -354,4 +354,17 @@ public class AddUpSituationController {
}
/**
* 在线获取实际累计已预扣预缴税额
*
* @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<AddUpDeductionMonthTaxAgentParam, Map<String, Object>>(user).run(getAddUpSituationWrapper(user)::onlineRequest, param);
}
}

View File

@ -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<String, Object> onlineRequest(AddUpDeductionMonthTaxAgentParam param) {
return getAddUpDeductionService(user).onlineRequest(param);
}
public AddUpDeductionRequestResultDTO onlineFeedback() {
return getAddUpDeductionService(user).onlineFeedback();
}
public PageInfo<AddUpDeductionRequestFailListDTO> onlineFeedbackFail(AddUpDeductionRequestFailQueryParam queryParam) {
if (queryParam.getRequestId() == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(153345, "在线获取的请求ID不可为空"));
}
PageInfo<AddUpDeductionRequestFailListDTO> page = getAddUpDeductionService(user).onlineFeedbackFail(queryParam);
return page;
}
public XSSFWorkbook exportOnlineFeedbackFail(Long requestId) {
List<AddUpDeductionRequestFailPO> 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.<AddUpDeductionRequestFormDTO>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;
// }
}

View File

@ -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<String, Object> onlineRequest(AddUpDeductionMonthTaxAgentParam param) {
return getAddUpSituationService(user).onlineRequest(param);
}
}