Merge branch 'release/2.15.2.2409.01' into release/个税版本

# Conflicts:
#	src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java
This commit is contained in:
钱涛 2024-09-29 15:08:38 +08:00
commit 5d8cfbd169
107 changed files with 5287 additions and 242 deletions

Binary file not shown.

View File

@ -1,5 +1,5 @@
log=false
defaultCloseNonStandard149=true
AESEncryptScrect=990EB004A1C862721C1513AE90038C9E
version=2.15.1.2407.01
version=2.15.2.2409.01
openFormulaForcedEditing=false

View File

@ -1,14 +0,0 @@
Delete from LeftMenuInfo where id=100186;
/
Delete from LeftMenuConfig where infoid=100186;
/
call LMConfig_U_ByInfoInsert (2,100118,9);
/
call LMInfo_Insert (100186,541290,'','',2,100118,9,18);
/
update LeftMenuInfo set mobxrouteurl = '',iconClassName = '',fullrouteurl='/spa/hrmSalary/static/index.html#/main/hrmSalary/externalPersonManage' where id = 100186;
/

View File

@ -0,0 +1,42 @@
CREATE TABLE hrsa_variable_archive (
id NUMBER(38,0) NOT NULL,
employee_id NUMBER(38,0) NULL ,
salary_month DATE NULL,
create_time DATE NOT NULL,
update_time DATE NOT NULL,
creator NUMBER(38,0) NOT NULL,
delete_type int NOT NULL,
tenant_key varchar2(10) NULL,
PRIMARY KEY (id)
);
/
CREATE TABLE hrsa_variable_archive_item (
id NUMBER(38,0) NOT NULL,
employee_id NUMBER(38,0) NOT NULL,
variable_archive_id NUMBER(38,0) NOT NULL,
variable_item_id NUMBER(38,0) NOT NULL,
item_value varchar2(255) NULL ,
create_time DATE NOT NULL ,
update_time DATE NOT NULL,
creator NUMBER(38,0) NOT NULL,
delete_type int NOT NULL ,
tenant_key varchar2(10) NULL,
PRIMARY KEY (id)
);
/
CREATE TABLE hrsa_variable_item (
id NUMBER(38,0) NOT NULL ,
name varchar2(255) NOT NULL ,
code varchar2(255) NOT NULL,
data_type varchar2(20) NULL,
create_time DATE NOT NULL,
update_time DATE NOT NULL,
creator NUMBER(38,0) NOT NULL,
delete_type int NOT NULL,
tenant_key varchar2(10) NULL ,
PRIMARY KEY (id)
);
/

View File

@ -0,0 +1,3 @@
alter table hrsa_variable_archive add tax_agent_id NUMBER(38,0);
/

View File

@ -0,0 +1,24 @@
delete from HtmlLabelIndex where id = 548025 and ( trim(indexdesc) is null ) ;
/
insert into HtmlLabelIndex(id,indexdesc) select 548025,'浮动数据' from HtmlLabelIndex where not exists (select id from HtmlLabelIndex where id = 548025 and ( trim(indexdesc) is not null )) and rownum = 1 ;
/
delete from HtmlLabelInfo where indexid = 548025 and languageid=7 and ( trim(labelname) is null ) ;
/
insert into HtmlLabelInfo(indexid,labelname,languageid) select * from (select 548025 as indexid ,'浮动数据' as content,7 as languageid from HtmlLabelInfo) t where not exists (select indexid,languageid from HtmlLabelInfo where indexid = 548025 and languageid=7 and ( trim(labelname) is not null )) and rownum = 1 ;
/
delete from HtmlLabelInfo where indexid = 548025 and languageid=8 and ( trim(labelname) is null or length(labelname)!=lengthb(labelname) ) ;
/
insert into HtmlLabelInfo(indexid,labelname,languageid) select * from (select 548025 as indexid ,'Floating Data' as content,8 as languageid from HtmlLabelInfo) t where not exists (select indexid,languageid from HtmlLabelInfo where indexid = 548025 and languageid=8 and ( trim(labelname) is not null and length(labelname)=lengthb(labelname) )) and rownum = 1 ;
/
delete from HtmlLabelInfo where indexid = 548025 and languageid=9 and ( trim(labelname) is null ) ;
/
insert into HtmlLabelInfo(indexid,labelname,languageid) select * from (select 548025 as indexid ,'浮動數據' as content,9 as languageid from HtmlLabelInfo) t where not exists (select indexid,languageid from HtmlLabelInfo where indexid = 548025 and languageid=9 and ( trim(labelname) is not null )) and rownum = 1 ;
/

View File

@ -0,0 +1,15 @@
Delete from LeftMenuInfo where id=100219;
/
Delete from LeftMenuConfig where infoid=100219;
/
call LMConfig_U_ByInfoInsert (2,100126,0);
/
call LMInfo_Insert (100219,548025,'','',2,100126,7,2);
/
update LeftMenuInfo set mobxrouteurl = '',iconClassName = '',fullrouteurl='/spa/hrmSalary/static/index.html#/main/hrmSalary/variableSalary' where id = 100219;
/

View File

@ -1,14 +0,0 @@
Delete from LeftMenuInfo where id=100186;
/
Delete from LeftMenuConfig where infoid=100186;
/
call LMConfig_U_ByInfoInsert (2,100118,9);
/
call LMInfo_Insert (100186,541290,'','',2,100118,9,18);
/
update LeftMenuInfo set mobxrouteurl = '',iconClassName = '',fullrouteurl='/spa/hrmSalary/static/index.html#/main/hrmSalary/externalPersonManage' where id = 100186;
/

View File

@ -0,0 +1,42 @@
CREATE TABLE hrsa_variable_archive (
id NUMBER(38,0) NOT NULL,
employee_id NUMBER(38,0) NULL ,
salary_month DATE NULL,
create_time DATE NOT NULL,
update_time DATE NOT NULL,
creator NUMBER(38,0) NOT NULL,
delete_type int NOT NULL,
tenant_key varchar2(10) NULL,
PRIMARY KEY (id)
);
/
CREATE TABLE hrsa_variable_archive_item (
id NUMBER(38,0) NOT NULL,
employee_id NUMBER(38,0) NOT NULL,
variable_archive_id NUMBER(38,0) NOT NULL,
variable_item_id NUMBER(38,0) NOT NULL,
item_value varchar2(255) NULL ,
create_time DATE NOT NULL ,
update_time DATE NOT NULL,
creator NUMBER(38,0) NOT NULL,
delete_type int NOT NULL ,
tenant_key varchar2(10) NULL,
PRIMARY KEY (id)
);
/
CREATE TABLE hrsa_variable_item (
id NUMBER(38,0) NOT NULL ,
name varchar2(255) NOT NULL ,
code varchar2(255) NOT NULL,
data_type varchar2(20) NULL,
create_time DATE NOT NULL,
update_time DATE NOT NULL,
creator NUMBER(38,0) NOT NULL,
delete_type int NOT NULL,
tenant_key varchar2(10) NULL ,
PRIMARY KEY (id)
);
/

View File

@ -0,0 +1,3 @@
alter table hrsa_variable_archive add tax_agent_id NUMBER(38,0);
/

View File

@ -0,0 +1,24 @@
delete from HtmlLabelIndex where id = 548025 and ( trim(indexdesc) is null ) ;
/
insert into HtmlLabelIndex(id,indexdesc) select 548025,'浮动数据' from HtmlLabelIndex where not exists (select id from HtmlLabelIndex where id = 548025 and ( trim(indexdesc) is not null )) and rownum = 1 ;
/
delete from HtmlLabelInfo where indexid = 548025 and languageid=7 and ( trim(labelname) is null ) ;
/
insert into HtmlLabelInfo(indexid,labelname,languageid) select * from (select 548025 as indexid ,'浮动数据' as content,7 as languageid from HtmlLabelInfo) t where not exists (select indexid,languageid from HtmlLabelInfo where indexid = 548025 and languageid=7 and ( trim(labelname) is not null )) and rownum = 1 ;
/
delete from HtmlLabelInfo where indexid = 548025 and languageid=8 and ( trim(labelname) is null or length(labelname)!=lengthb(labelname) ) ;
/
insert into HtmlLabelInfo(indexid,labelname,languageid) select * from (select 548025 as indexid ,'Floating Data' as content,8 as languageid from HtmlLabelInfo) t where not exists (select indexid,languageid from HtmlLabelInfo where indexid = 548025 and languageid=8 and ( trim(labelname) is not null and length(labelname)=lengthb(labelname) )) and rownum = 1 ;
/
delete from HtmlLabelInfo where indexid = 548025 and languageid=9 and ( trim(labelname) is null ) ;
/
insert into HtmlLabelInfo(indexid,labelname,languageid) select * from (select 548025 as indexid ,'浮動數據' as content,9 as languageid from HtmlLabelInfo) t where not exists (select indexid,languageid from HtmlLabelInfo where indexid = 548025 and languageid=9 and ( trim(labelname) is not null )) and rownum = 1 ;
/

View File

@ -0,0 +1,15 @@
Delete from LeftMenuInfo where id=100219;
/
Delete from LeftMenuConfig where infoid=100219;
/
call LMConfig_U_ByInfoInsert (2,100126,0);
/
call LMInfo_Insert (100219,548025,'','',2,100126,7,2);
/
update LeftMenuInfo set mobxrouteurl = '',iconClassName = '',fullrouteurl='/spa/hrmSalary/static/index.html#/main/hrmSalary/variableSalary' where id = 100219;
/

View File

@ -1,14 +0,0 @@
Delete from LeftMenuInfo where id=100186;
/
Delete from LeftMenuConfig where infoid=100186;
/
call LMConfig_U_ByInfoInsert (2,100118,9);
/
call LMInfo_Insert (100186,541290,'','',2,100118,9,18);
/
update LeftMenuInfo set mobxrouteurl = '',iconClassName = '',fullrouteurl='/spa/hrmSalary/static/index.html#/main/hrmSalary/externalPersonManage' where id = 100186;
/

View File

@ -0,0 +1,42 @@
CREATE TABLE hrsa_variable_archive (
id NUMBER(38,0) NOT NULL,
employee_id NUMBER(38,0) NULL ,
salary_month DATE NULL,
create_time DATE NOT NULL,
update_time DATE NOT NULL,
creator NUMBER(38,0) NOT NULL,
delete_type int NOT NULL,
tenant_key varchar2(10) NULL,
PRIMARY KEY (id)
);
/
CREATE TABLE hrsa_variable_archive_item (
id NUMBER(38,0) NOT NULL,
employee_id NUMBER(38,0) NOT NULL,
variable_archive_id NUMBER(38,0) NOT NULL,
variable_item_id NUMBER(38,0) NOT NULL,
item_value varchar2(255) NULL ,
create_time DATE NOT NULL ,
update_time DATE NOT NULL,
creator NUMBER(38,0) NOT NULL,
delete_type int NOT NULL ,
tenant_key varchar2(10) NULL,
PRIMARY KEY (id)
);
/
CREATE TABLE hrsa_variable_item (
id NUMBER(38,0) NOT NULL ,
name varchar2(255) NOT NULL ,
code varchar2(255) NOT NULL,
data_type varchar2(20) NULL,
create_time DATE NOT NULL,
update_time DATE NOT NULL,
creator NUMBER(38,0) NOT NULL,
delete_type int NOT NULL,
tenant_key varchar2(10) NULL ,
PRIMARY KEY (id)
);
/

View File

@ -0,0 +1,3 @@
alter table hrsa_variable_archive add tax_agent_id NUMBER(38,0);
/

View File

@ -0,0 +1,24 @@
delete from HtmlLabelIndex where id = 548025 and ( trim(indexdesc) is null ) ;
/
insert into HtmlLabelIndex(id,indexdesc) select 548025,'浮动数据' from HtmlLabelIndex where not exists (select id from HtmlLabelIndex where id = 548025 and ( trim(indexdesc) is not null )) and rownum = 1 ;
/
delete from HtmlLabelInfo where indexid = 548025 and languageid=7 and ( trim(labelname) is null ) ;
/
insert into HtmlLabelInfo(indexid,labelname,languageid) select * from (select 548025 as indexid ,'浮动数据' as content,7 as languageid from HtmlLabelInfo) t where not exists (select indexid,languageid from HtmlLabelInfo where indexid = 548025 and languageid=7 and ( trim(labelname) is not null )) and rownum = 1 ;
/
delete from HtmlLabelInfo where indexid = 548025 and languageid=8 and ( trim(labelname) is null or length(labelname)!=lengthb(labelname) ) ;
/
insert into HtmlLabelInfo(indexid,labelname,languageid) select * from (select 548025 as indexid ,'Floating Data' as content,8 as languageid from HtmlLabelInfo) t where not exists (select indexid,languageid from HtmlLabelInfo where indexid = 548025 and languageid=8 and ( trim(labelname) is not null and length(labelname)=lengthb(labelname) )) and rownum = 1 ;
/
delete from HtmlLabelInfo where indexid = 548025 and languageid=9 and ( trim(labelname) is null ) ;
/
insert into HtmlLabelInfo(indexid,labelname,languageid) select * from (select 548025 as indexid ,'浮動數據' as content,9 as languageid from HtmlLabelInfo) t where not exists (select indexid,languageid from HtmlLabelInfo where indexid = 548025 and languageid=9 and ( trim(labelname) is not null )) and rownum = 1 ;
/

View File

@ -0,0 +1,15 @@
Delete from LeftMenuInfo where id=100219;
/
Delete from LeftMenuConfig where infoid=100219;
/
call LMConfig_U_ByInfoInsert (2,100126,0);
/
call LMInfo_Insert (100219,548025,'','',2,100126,7,2);
/
update LeftMenuInfo set mobxrouteurl = '',iconClassName = '',fullrouteurl='/spa/hrmSalary/static/index.html#/main/hrmSalary/variableSalary' where id = 100219;
/

View File

@ -1,10 +0,0 @@
Delete from LeftMenuInfo where id=100186
;
Delete from LeftMenuConfig where infoid=100186
;
call LMConfig_U_ByInfoInsert (2,100118,9)
;
call LMInfo_Insert (100186,541290,'','',2,100118,9,18)
;
update LeftMenuInfo set mobxrouteurl = '',iconClassName = '',fullrouteurl='/spa/hrmSalary/static/index.html#/main/hrmSalary/externalPersonManage' where id = 100186
;

View File

@ -0,0 +1,43 @@
CREATE TABLE hrsa_variable_archive (
id bigint NOT NULL,
employee_id bigint NULL ,
salary_month datetime NULL,
create_time datetime NOT NULL,
update_time datetime NOT NULL,
creator bigint NOT NULL,
delete_type int NOT NULL,
tenant_key varchar(10) NULL,
PRIMARY KEY (id)
)
;
CREATE TABLE hrsa_variable_archive_item (
id bigint NOT NULL,
employee_id bigint NOT NULL,
variable_archive_id bigint NOT NULL,
variable_item_id bigint NOT NULL,
item_value varchar(255) NULL ,
create_time datetime NOT NULL ,
update_time datetime NOT NULL,
creator bigint NOT NULL,
delete_type int NOT NULL ,
tenant_key varchar(10) NULL,
PRIMARY KEY (id)
) ;
CREATE TABLE hrsa_variable_item (
id bigint NOT NULL,
name varchar(255) NOT NULL,
code varchar(255) NOT NULL,
data_type varchar(20) NULL,
create_time datetime NOT NULL,
update_time datetime NOT NULL,
creator bigint NOT NULL,
delete_type int NOT NULL,
tenant_key varchar(10) NULL,
PRIMARY KEY (id)
);

View File

@ -0,0 +1 @@
alter table hrsa_variable_archive add tax_agent_id bigint;

View File

@ -0,0 +1,16 @@
delete from HtmlLabelIndex where id = 548025 and ( indexdesc is null or indexdesc = '' )
;
insert into HtmlLabelIndex(id,indexdesc) select 548025,'浮动数据' from HtmlLabelIndex where not exists (select id from HtmlLabelIndex where id = 548025 and ( indexdesc is not null and indexdesc <> '' )) limit 1
;
delete from HtmlLabelInfo where indexid = 548025 and languageid=7 and ( labelname is null or labelname = '' )
;
insert into HtmlLabelInfo(indexid,labelname,languageid) select * from (select 548025 as indexid ,'浮动数据' as content,7 as languageid from HtmlLabelInfo) t where not exists (select indexid,languageid from HtmlLabelInfo where indexid = 548025 and languageid=7 and ( labelname is not null and labelname <> '' )) limit 1
;
delete from HtmlLabelInfo where indexid = 548025 and languageid=8 and ( labelname is null or labelname = '' or length(labelname)!=char_length(labelname) )
;
insert into HtmlLabelInfo(indexid,labelname,languageid) select * from (select 548025 as indexid ,'Floating Data' as content,8 as languageid from HtmlLabelInfo) t where not exists (select indexid,languageid from HtmlLabelInfo where indexid = 548025 and languageid=8 and ( labelname is not null and labelname <> '' and length(labelname)=char_length(labelname) )) limit 1
;
delete from HtmlLabelInfo where indexid = 548025 and languageid=9 and ( labelname is null or labelname = '' )
;
insert into HtmlLabelInfo(indexid,labelname,languageid) select * from (select 548025 as indexid ,'浮動數據' as content,9 as languageid from HtmlLabelInfo) t where not exists (select indexid,languageid from HtmlLabelInfo where indexid = 548025 and languageid=9 and ( labelname is not null and labelname <> '' )) limit 1
;

View File

@ -0,0 +1,10 @@
Delete from LeftMenuInfo where id=100219
;
Delete from LeftMenuConfig where infoid=100219
;
call LMConfig_U_ByInfoInsert (2,100126,0)
;
call LMInfo_Insert (100219,548025,'','',2,100126,7,2)
;
update LeftMenuInfo set mobxrouteurl = '',iconClassName = '',fullrouteurl='/spa/hrmSalary/static/index.html#/main/hrmSalary/variableSalary' where id = 100219
;

View File

@ -1,10 +0,0 @@
Delete from LeftMenuInfo where id=100186
/
Delete from LeftMenuConfig where infoid=100186
/
call LMConfig_U_ByInfoInsert (2,100118,9)
/
call LMInfo_Insert (100186,541290,'','',2,100118,9,18)
/
update LeftMenuInfo set mobxrouteurl = '',iconClassName = '',fullrouteurl='/spa/hrmSalary/static/index.html#/main/hrmSalary/externalPersonManage' where id = 100186
/

View File

@ -0,0 +1,42 @@
CREATE TABLE hrsa_variable_archive (
id NUMBER(38,0) NOT NULL,
employee_id NUMBER(38,0) NULL ,
salary_month DATE NULL,
create_time DATE NOT NULL,
update_time DATE NOT NULL,
creator NUMBER(38,0) NOT NULL,
delete_type int NOT NULL,
tenant_key varchar2(10) NULL,
PRIMARY KEY (id)
)
/
CREATE TABLE hrsa_variable_archive_item (
id NUMBER(38,0) NOT NULL,
employee_id NUMBER(38,0) NOT NULL,
variable_archive_id NUMBER(38,0) NOT NULL,
variable_item_id NUMBER(38,0) NOT NULL,
item_value varchar2(255) NULL ,
create_time DATE NOT NULL ,
update_time DATE NOT NULL,
creator NUMBER(38,0) NOT NULL,
delete_type int NOT NULL ,
tenant_key varchar2(10) NULL,
PRIMARY KEY (id)
)
/
CREATE TABLE hrsa_variable_item (
id NUMBER(38,0) NOT NULL ,
name varchar2(255) NOT NULL ,
code varchar2(255) NOT NULL,
data_type varchar2(20) NULL,
create_time DATE NOT NULL,
update_time DATE NOT NULL,
creator NUMBER(38,0) NOT NULL,
delete_type int NOT NULL,
tenant_key varchar2(10) NULL ,
PRIMARY KEY (id)
)
/

View File

@ -0,0 +1,2 @@
alter table hrsa_variable_archive add tax_agent_id NUMBER(38,0)
/

View File

@ -0,0 +1,16 @@
delete from HtmlLabelIndex where id = 548025 and ( trim(indexdesc) is null )
/
insert into HtmlLabelIndex(id,indexdesc) select 548025,'浮动数据' from HtmlLabelIndex where not exists (select id from HtmlLabelIndex where id = 548025 and ( trim(indexdesc) is not null )) and rownum = 1
/
delete from HtmlLabelInfo where indexid = 548025 and languageid=7 and ( trim(labelname) is null )
/
insert into HtmlLabelInfo(indexid,labelname,languageid) select * from (select 548025 as indexid ,'浮动数据' as content,7 as languageid from HtmlLabelInfo) t where not exists (select indexid,languageid from HtmlLabelInfo where indexid = 548025 and languageid=7 and ( trim(labelname) is not null )) and rownum = 1
/
delete from HtmlLabelInfo where indexid = 548025 and languageid=8 and ( trim(labelname) is null or length(labelname)!=lengthb(labelname) )
/
insert into HtmlLabelInfo(indexid,labelname,languageid) select * from (select 548025 as indexid ,'Floating Data' as content,8 as languageid from HtmlLabelInfo) t where not exists (select indexid,languageid from HtmlLabelInfo where indexid = 548025 and languageid=8 and ( trim(labelname) is not null and length(labelname)=lengthb(labelname) )) and rownum = 1
/
delete from HtmlLabelInfo where indexid = 548025 and languageid=9 and ( trim(labelname) is null )
/
insert into HtmlLabelInfo(indexid,labelname,languageid) select * from (select 548025 as indexid ,'浮動數據' as content,9 as languageid from HtmlLabelInfo) t where not exists (select indexid,languageid from HtmlLabelInfo where indexid = 548025 and languageid=9 and ( trim(labelname) is not null )) and rownum = 1
/

View File

@ -0,0 +1,10 @@
Delete from LeftMenuInfo where id=100219
/
Delete from LeftMenuConfig where infoid=100219
/
call LMConfig_U_ByInfoInsert (2,100126,0)
/
call LMInfo_Insert (100219,548025,'','',2,100126,7,2)
/
update LeftMenuInfo set mobxrouteurl = '',iconClassName = '',fullrouteurl='/spa/hrmSalary/static/index.html#/main/hrmSalary/variableSalary' where id = 100219
/

View File

@ -1,10 +0,0 @@
Delete from LeftMenuInfo where id=100186;
/
Delete from LeftMenuConfig where infoid=100186;
/
select LMConfig_U_ByInfoInsert (2,100118,9);
/
select LMInfo_Insert (100186,541290,'','',2,100118,9,18);
/
update LeftMenuInfo set mobxrouteurl = '',iconClassName = '',fullrouteurl='/spa/hrmSalary/static/index.html#/main/hrmSalary/externalPersonManage' where id = 100186;
/

View File

@ -0,0 +1,38 @@
CREATE TABLE hrsa_variable_archive_item (
id bigint NOT NULL,
employee_id bigint NOT NULL,
variable_archive_id bigint NOT NULL,
variable_item_id bigint NOT NULL,
item_value varchar(255) NULL,
create_time timestamp NOT NULL,
update_time timestamp NOT NULL,
creator bigint NOT NULL,
delete_type int NOT NULL,
tenant_key varchar(10) NULL,
PRIMARY KEY (id)
) ;
CREATE TABLE hrsa_variable_archive (
id bigint NOT NULL,
employee_id bigint NULL,
salary_month timestamp NULL ,
create_time timestamp NOT NULL,
update_time timestamp NOT NULL,
creator bigint NOT NULL,
delete_type int NOT NULL,
tenant_key varchar(10) NULL,
PRIMARY KEY (id)
);
CREATE TABLE hrsa_variable_item (
id bigint NOT NULL,
name varchar(255) NOT NULL,
code varchar(255) NOT NULL,
data_type varchar(20)NULL ,
create_time timestamp NOT NULL,
update_time timestamp NOT NULL,
creator bigint NOT NULL,
delete_type int NOT NULL,
tenant_key varchar(10) NULL,
PRIMARY KEY (id)
);

View File

@ -0,0 +1 @@
alter table hrsa_variable_archive add tax_agent_id bigint;

View File

@ -0,0 +1,16 @@
delete from HtmlLabelIndex where id = 548025 and ( indexdesc is null or indexdesc = '' ) ;
/
insert into HtmlLabelIndex(id,indexdesc) select 548025,'浮动数据' from HtmlLabelIndex where not exists (select id from HtmlLabelIndex where id = 548025 and ( indexdesc is not null and indexdesc <> '' )) limit 1 ;
/
delete from HtmlLabelInfo where indexid = 548025 and languageid=7 and ( labelname is null or labelname = '' ) ;
/
insert into HtmlLabelInfo(indexid,labelname,languageid) select * from (select 548025 as indexid ,'浮动数据' as content,7 as languageid from HtmlLabelInfo) t where not exists (select indexid,languageid from HtmlLabelInfo where indexid = 548025 and languageid=7 and ( labelname is not null and labelname <> '' )) limit 1 ;
/
delete from HtmlLabelInfo where indexid = 548025 and languageid=8 and ( labelname is null or labelname = '' or length(labelname)!=octet_length(labelname) ) ;
/
insert into HtmlLabelInfo(indexid,labelname,languageid) select * from (select 548025 as indexid ,'Floating Data' as content,8 as languageid from HtmlLabelInfo) t where not exists (select indexid,languageid from HtmlLabelInfo where indexid = 548025 and languageid=8 and ( labelname is not null and labelname <> '' and length(labelname)=octet_length(labelname) )) limit 1 ;
/
delete from HtmlLabelInfo where indexid = 548025 and languageid=9 and ( labelname is null or labelname = '' ) ;
/
insert into HtmlLabelInfo(indexid,labelname,languageid) select * from (select 548025 as indexid ,'浮動數據' as content,9 as languageid from HtmlLabelInfo) t where not exists (select indexid,languageid from HtmlLabelInfo where indexid = 548025 and languageid=9 and ( labelname is not null and labelname <> '' )) limit 1 ;
/

View File

@ -0,0 +1,10 @@
Delete from LeftMenuInfo where id=100219
;
Delete from LeftMenuConfig where infoid=100219
;
select LMConfig_U_ByInfoInsert (2,100126,0)
;
select LMInfo_Insert (100219,548025,'','',2,100126,7,2)
;
update LeftMenuInfo set mobxrouteurl = '',iconClassName = '',fullrouteurl='/spa/hrmSalary/static/index.html#/main/hrmSalary/variableSalary' where id = 100219
;

View File

@ -1,10 +0,0 @@
Delete from LeftMenuInfo where id=100186
GO
Delete from LeftMenuConfig where infoid=100186
GO
EXECUTE LMConfig_U_ByInfoInsert 2,100118,9
GO
EXECUTE LMInfo_Insert 100186,541290,'','',2,100118,9,18
GO
update LeftMenuInfo set mobxrouteurl = '',iconClassName = '',fullrouteurl='/spa/hrmSalary/static/index.html#/main/hrmSalary/externalPersonManage' where id = 100186
GO

View File

@ -0,0 +1,41 @@
CREATE TABLE hrsa_variable_archive_item (
id bigint NOT NULL,
employee_id bigint NOT NULL,
variable_archive_id bigint NOT NULL,
variable_item_id bigint NOT NULL,
item_value varchar(255) NULL,
create_time datetime NOT NULL,
update_time datetime NOT NULL,
creator bigint NOT NULL,
delete_type int NOT NULL,
tenant_key varchar(10) NULL,
PRIMARY KEY (id)
)
GO
CREATE TABLE hrsa_variable_archive (
id bigint NOT NULL,
employee_id bigint NULL,
salary_month datetime NULL ,
create_time datetime NOT NULL,
update_time datetime NOT NULL,
creator bigint NOT NULL,
delete_type int NOT NULL,
tenant_key varchar(10) NULL,
PRIMARY KEY (id)
)
GO
CREATE TABLE hrsa_variable_item (
id bigint NOT NULL,
name varchar(255) NOT NULL,
code varchar(255) NOT NULL,
data_type varchar(20)NULL ,
create_time datetime NOT NULL,
update_time datetime NOT NULL,
creator bigint NOT NULL,
delete_type int NOT NULL,
tenant_key varchar(10) NULL,
PRIMARY KEY (id)
)
GO

View File

@ -0,0 +1,2 @@
alter table hrsa_variable_archive add tax_agent_id bigint
GO

View File

@ -0,0 +1,16 @@
delete from HtmlLabelIndex where id = 548025 and ( indexdesc is null or indexdesc = '' )
GO
insert into HtmlLabelIndex(id,indexdesc) select top 1 548025,'浮动数据' from HtmlLabelIndex where not exists (select id from HtmlLabelIndex where id = 548025 and ( indexdesc is not null and indexdesc <> '' ))
GO
delete from HtmlLabelInfo where indexid = 548025 and languageid=7 and ( labelname is null or labelname = '' )
GO
insert into HtmlLabelInfo(indexid,labelname,languageid) select * from (select top 1 548025 as indexid ,'浮动数据' as content,7 as languageid from HtmlLabelInfo) t where not exists (select indexid,languageid from HtmlLabelInfo where indexid = 548025 and languageid=7 and ( labelname is not null and labelname <> '' ))
GO
delete from HtmlLabelInfo where indexid = 548025 and languageid=8 and ( labelname is null or labelname = '' or labelname like '%[吖-座]%' )
GO
insert into HtmlLabelInfo(indexid,labelname,languageid) select * from (select top 1 548025 as indexid ,'Floating Data' as content,8 as languageid from HtmlLabelInfo) t where not exists (select indexid,languageid from HtmlLabelInfo where indexid = 548025 and languageid=8 and ( labelname is not null and labelname <> '' and labelname not like '%[吖-座]%' ))
GO
delete from HtmlLabelInfo where indexid = 548025 and languageid=9 and ( labelname is null or labelname = '' )
GO
insert into HtmlLabelInfo(indexid,labelname,languageid) select * from (select top 1 548025 as indexid ,'浮動數據' as content,9 as languageid from HtmlLabelInfo) t where not exists (select indexid,languageid from HtmlLabelInfo where indexid = 548025 and languageid=9 and ( labelname is not null and labelname <> '' ))
GO

View File

@ -0,0 +1,10 @@
Delete from LeftMenuInfo where id=100219
GO
Delete from LeftMenuConfig where infoid=100219
GO
EXECUTE LMConfig_U_ByInfoInsert 2,100126,0
GO
EXECUTE LMInfo_Insert 100219,548025,'','',2,100126,7,2
GO
update LeftMenuInfo set mobxrouteurl = '',iconClassName = '',fullrouteurl='/spa/hrmSalary/static/index.html#/main/hrmSalary/variableSalary' where id = 100219
GO

View File

@ -1,14 +0,0 @@
Delete from LeftMenuInfo where id=100186;
/
Delete from LeftMenuConfig where infoid=100186;
/
call LMConfig_U_ByInfoInsert (2,100118,9);
/
call LMInfo_Insert (100186,541290,'','',2,100118,9,18);
/
update LeftMenuInfo set mobxrouteurl = '',iconClassName = '',fullrouteurl='/spa/hrmSalary/static/index.html#/main/hrmSalary/externalPersonManage' where id = 100186;
/

View File

@ -0,0 +1,42 @@
CREATE TABLE hrsa_variable_archive (
id NUMBER(38,0) NOT NULL,
employee_id NUMBER(38,0) NULL ,
salary_month DATE NULL,
create_time DATE NOT NULL,
update_time DATE NOT NULL,
creator NUMBER(38,0) NOT NULL,
delete_type int NOT NULL,
tenant_key varchar2(10) NULL,
PRIMARY KEY (id)
);
/
CREATE TABLE hrsa_variable_archive_item (
id NUMBER(38,0) NOT NULL,
employee_id NUMBER(38,0) NOT NULL,
variable_archive_id NUMBER(38,0) NOT NULL,
variable_item_id NUMBER(38,0) NOT NULL,
item_value varchar2(255) NULL ,
create_time DATE NOT NULL ,
update_time DATE NOT NULL,
creator NUMBER(38,0) NOT NULL,
delete_type int NOT NULL ,
tenant_key varchar2(10) NULL,
PRIMARY KEY (id)
);
/
CREATE TABLE hrsa_variable_item (
id NUMBER(38,0) NOT NULL ,
name varchar2(255) NOT NULL ,
code varchar2(255) NOT NULL,
data_type varchar2(20) NULL,
create_time DATE NOT NULL,
update_time DATE NOT NULL,
creator NUMBER(38,0) NOT NULL,
delete_type int NOT NULL,
tenant_key varchar2(10) NULL ,
PRIMARY KEY (id)
);
/

View File

@ -0,0 +1,3 @@
alter table hrsa_variable_archive add tax_agent_id NUMBER(38,0);
/

View File

@ -0,0 +1,24 @@
delete from HtmlLabelIndex where id = 548025 and ( trim(indexdesc) is null ) ;
/
insert into HtmlLabelIndex(id,indexdesc) select 548025,'浮动数据' from HtmlLabelIndex where not exists (select id from HtmlLabelIndex where id = 548025 and ( trim(indexdesc) is not null )) and rownum = 1 ;
/
delete from HtmlLabelInfo where indexid = 548025 and languageid=7 and ( trim(labelname) is null ) ;
/
insert into HtmlLabelInfo(indexid,labelname,languageid) select * from (select 548025 as indexid ,'浮动数据' as content,7 as languageid from HtmlLabelInfo) t where not exists (select indexid,languageid from HtmlLabelInfo where indexid = 548025 and languageid=7 and ( trim(labelname) is not null )) and rownum = 1 ;
/
delete from HtmlLabelInfo where indexid = 548025 and languageid=8 and ( trim(labelname) is null or length(labelname)!=lengthb(labelname) ) ;
/
insert into HtmlLabelInfo(indexid,labelname,languageid) select * from (select 548025 as indexid ,'Floating Data' as content,8 as languageid from HtmlLabelInfo) t where not exists (select indexid,languageid from HtmlLabelInfo where indexid = 548025 and languageid=8 and ( trim(labelname) is not null and length(labelname)=lengthb(labelname) )) and rownum = 1 ;
/
delete from HtmlLabelInfo where indexid = 548025 and languageid=9 and ( trim(labelname) is null ) ;
/
insert into HtmlLabelInfo(indexid,labelname,languageid) select * from (select 548025 as indexid ,'浮動數據' as content,9 as languageid from HtmlLabelInfo) t where not exists (select indexid,languageid from HtmlLabelInfo where indexid = 548025 and languageid=9 and ( trim(labelname) is not null )) and rownum = 1 ;
/

View File

@ -0,0 +1,15 @@
Delete from LeftMenuInfo where id=100219;
/
Delete from LeftMenuConfig where infoid=100219;
/
call LMConfig_U_ByInfoInsert (2,100126,0);
/
call LMInfo_Insert (100219,548025,'','',2,100126,7,2);
/
update LeftMenuInfo set mobxrouteurl = '',iconClassName = '',fullrouteurl='/spa/hrmSalary/static/index.html#/main/hrmSalary/variableSalary' where id = 100219;
/

View File

@ -10,6 +10,14 @@ left join hrsa_tax_agent agent on agent.id=sob.tax_agent_id and agent.delete_typ
left join hrmresource e on e.id= result.employee_id
select e.lastname, record.salary_month as 薪资月, item.name as 薪资项 ,result.result_value as 值
from hrsa_salary_acct_record record
left join hrsa_salary_acct_result result on record.id = result.salary_acct_record_id and result.delete_type = 0 and record.delete_type = 0
left join hrsa_salary_item item on result.salary_item_id = item.id and item.delete_type = 0
left join hrmresource e on e.id= result.employee_id
where item.name = '工资薪金合计'
# 获取档案信息
select i.item_value from hrsa_salary_archive_item i

View File

@ -0,0 +1,8 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/variableSalary")
public class VariableArchiveController extends com.engine.salary.web.VariableArchiveController {
}

View File

@ -0,0 +1,8 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/variableSalaryItem")
public class VariableItemController extends com.engine.salary.web.VariableItemController {
}

View File

@ -15,6 +15,11 @@ public class SalaryItemConstant {
*/
public static final String DYNAMIC_SUFFIX = "_salaryItem";
/**
* 列表中浮动薪资项目动态列后缀标识
*/
public static final String VARIABLE_ITEM_DYNAMIC_SUFFIX = "_variableItem";
/**
* 薪资核算导入缓存表头字段key
*/

View File

@ -36,6 +36,10 @@ public class AttendQuoteDataBO {
continue;
}
String key = field.getCode();
//兼容出勤班次的key
if(key.startsWith("attendanceSerial_")){
key = key.replace("attendanceSerial_", "");
}
if (m.containsKey(key)) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("employeeId", m.get("resourceId"));

View File

@ -0,0 +1,281 @@
package com.engine.salary.entity.datacollection.bo;
import com.cloudstore.eccom.constant.WeaBoolAttr;
import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.engine.salary.constant.SalaryItemConstant;
import com.engine.salary.entity.datacollection.po.VariableItemPO;
import com.engine.salary.util.SalaryI18nUtil;
import java.util.ArrayList;
import java.util.List;
/**
* @Description: 浮动薪资档案
* @Author: xzy
*/
public class VariableArchiveBO {
@Override
public String toString() {
return "SalaryArchiveBO{}";
}
/**
* 构建表格动态列
*
* @param variableItems
*/
public static List<WeaTableColumn> buildVariableArchiveTable(List<VariableItemPO> variableItems) {
// 表格表头
List<WeaTableColumn> columns = new ArrayList<>();
WeaTableColumn idColumn = new WeaTableColumn("100px", "id", "id");
idColumn.setIsPrimarykey(WeaBoolAttr.TRUE);
idColumn.setDisplay(WeaBoolAttr.FALSE);
columns.add(idColumn);
WeaTableColumn employeeIdColumn = new WeaTableColumn("100px", "人员信息表的主键id", "employeeId");
employeeIdColumn.setDisplay(WeaBoolAttr.FALSE);
columns.add(employeeIdColumn);
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(0, "薪资所属月"), "salaryMonth"));
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(85429, "个税扣缴义务人"), "taxAgentName"));
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(85429, "姓名"), "username"));
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86185, "部门"), "departmentName"));
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86186, "手机号"), "mobile"));
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86185, "工号"), "workcode"));
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86186, "证件号码"), "idNo"));
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86187, "入职日期"), "companystartdate"));
for (VariableItemPO variableItem : variableItems) {
columns.add(new WeaTableColumn("100px", variableItem.getName(), variableItem.getId() + SalaryItemConstant.VARIABLE_ITEM_DYNAMIC_SUFFIX));
}
return columns;
}
// /**
// * 构建薪资档案数据
// *
// * @param salaryArchiveList
// * @param salaryArchiveItemDataList
// * @param localDateRange
// * @param allEmployeeIds
// * @param isOnlyTaxAgent
// * @return
// */
// public static List<SalaryArchiveDataDTO> buildSalaryArchiveData(List<SalaryArchivePO> salaryArchiveList,
// List<SalaryArchiveItemPO> salaryArchiveItemDataList,
// LocalDateRange localDateRange,
// List<Long> allEmployeeIds,
// boolean isOnlyTaxAgent) {
// // 开始日期
// Date start = localDateRange.getFromDate();
// // 结束日期
// Date end = localDateRange.getEndDate();
//
// List<SalaryArchiveDataDTO> list = new ArrayList<>();
// allEmployeeIds.forEach(e -> {
// // 同一个人的档案数据
// List<SalaryArchivePO> salaryArchives = salaryArchiveList.stream().filter(f -> f.getEmployeeId().equals(e)).collect(Collectors.toList());
// List<Long> salaryArchiveIds = salaryArchives.stream().map(SalaryArchivePO::getId).collect(Collectors.toList());
// // 同一个人的薪资项目调整历史数据
// List<SalaryArchiveItemPO> salaryArchiveItems = salaryArchiveItemDataList.stream().filter(d -> salaryArchiveIds.contains(d.getSalaryArchiveId())).collect(Collectors.toList());
// List<Long> salaryArchiveItemIds = salaryArchiveItems.stream().map(SalaryArchiveItemPO::getSalaryItemId).distinct().collect(Collectors.toList());
//
// SalaryArchiveDataDTO salaryArchiveData = new SalaryArchiveDataDTO();
// salaryArchiveData.setEmployeeId(e);
// List<SalaryArchiveTaxAgentDataDTO> taxAgents = new ArrayList<>();
// // 按个税扣缴义务人生效日期时间段切割
// for (SalaryArchivePO salaryArchive : salaryArchives) {
// Date fromDate = salaryArchive.getPayStartDate();
// Date endDate = salaryArchive.getPayEndDate();
// // 起始发薪日不为空且不能比结束日期晚最后发薪日可空可不空但是如果不为空就不能比开始日期早且起始发薪日不能晚于最后发薪日
// boolean isEnable = fromDate != null && !fromDate.after(end) && (endDate == null || (!fromDate.after(endDate) && !endDate.before(start)));
// if (isEnable) {
// SalaryArchiveTaxAgentDataDTO taxAgent = new SalaryArchiveTaxAgentDataDTO();
// taxAgent.setTaxAgentId(salaryArchive.getTaxAgentId());
// // taxAgent.setIncomeCategory(salaryArchive.getIncomeCategory());
// // taxAgent.setSalarySobIds(salaryArchiveSobList.stream().filter(sob->sob.getSalaryArchiveId().equals(salaryArchive.getId())).map(SalaryArchiveSobPO::getSalarySobId).distinct().collect(Collectors.toList()));
// taxAgent.setEffectiveDateRange(LocalDateRange.builder().fromDate((fromDate.before(start) ? start : fromDate)).endDate(endDate == null || endDate.after(end) ? end : endDate).build());
// // 薪资项目数据按个税扣缴义务人切割
// if (!isOnlyTaxAgent) {
// // 开始日期
// Date startItem = taxAgent.getEffectiveDateRange().getFromDate();
// // 结束日期
// Date endItem = taxAgent.getEffectiveDateRange().getEndDate();
// Date endTempItem = endItem;
// List<SalaryArchiveItemDataDTO> salaryItemValues = new ArrayList<>();
// for (Long salaryArchiveItemId : salaryArchiveItemIds) {
// boolean flag = false;
// for (SalaryArchiveItemPO salaryArchiveItem : salaryArchiveItems) {
// if (!salaryArchiveItemId.equals(salaryArchiveItem.getSalaryItemId()) || !salaryArchiveItem.getSalaryArchiveId().equals(salaryArchive.getId())) {
// continue;
// }
// Date fromDateItem = salaryArchiveItem.getEffectiveTime();
// if (fromDateItem.after(endTempItem) || endTempItem.before(startItem)) {
// continue;
// }
// if (endTempItem.equals(startItem) && flag) {
// continue;
// }
// SalaryArchiveItemDataDTO salaryArchiveItemData = new SalaryArchiveItemDataDTO();
// salaryArchiveItemData.setEffectiveDateRange(LocalDateRange.builder().fromDate((fromDateItem.before(startItem) ? startItem : fromDateItem)).endDate(endTempItem).build());
// salaryArchiveItemData.setSalaryItemId(salaryArchiveItem.getSalaryItemId());
// salaryArchiveItemData.setValue(salaryArchiveItem.getItemValue());
// salaryItemValues.add(salaryArchiveItemData);
// flag = true;
// endTempItem = fromDateItem;
// }
// endTempItem = endItem;
// }
// taxAgent.setSalaryItemValues(salaryItemValues);
// }
// taxAgents.add(taxAgent);
// }
// }
// salaryArchiveData.setTaxAgents(taxAgents);
// list.add(salaryArchiveData);
// });
//
// return list;
// }
//
// /**
// * 构建增量数据
// *
// * @param taxAgentEmpChangeList
// * @param salaryArchiveList
// * @param salaryArchiveItemList
// * @param currentEmployeeId
// */
// public static ChangeData buildChangeData(List<TaxAgentEmpChangePO> taxAgentEmpChangeList, List<SalaryArchivePO> salaryArchiveList, List<SalaryArchiveItemPO> salaryArchiveItemList, Long currentEmployeeId) {
// List<Long> changeIds = taxAgentEmpChangeList.stream().map(TaxAgentEmpChangePO::getId).collect(Collectors.toList());
// // 根据个税扣缴义务人和人员以及增量类型分组
// Map<String, Long> changeTypeMap = taxAgentEmpChangeList.stream().collect(Collectors.groupingBy(change -> change.getTaxAgentId() + "-" + change.getEmployeeId() + "-" + change.getChangeType(), Collectors.counting()));
// // 顺序倒转
// Collections.reverse(taxAgentEmpChangeList);
// // 去重
// taxAgentEmpChangeList = taxAgentEmpChangeList.stream()
// .collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getTaxAgentId() + "-" + f.getEmployeeId()))), ArrayList::new));
// List<TaxAgentEmpChangePO> taxAgentEmpChanges = taxAgentEmpChangeList
// .stream()
// // 不相等则保留否则忽略
// .filter(change -> !Objects.equals(changeTypeMap.get(change.getTaxAgentId() + "-" + change.getEmployeeId() + "-" + TaxAgentEmpChangeTypeEnum.ADD.getValue())
// , changeTypeMap.get(change.getTaxAgentId() + "-" + change.getEmployeeId() + "-" + TaxAgentEmpChangeTypeEnum.DEL.getValue())))
// .collect(Collectors.toList());
//
// Date now = new Date();
// Date today = new Date();
// List<String> stopStatus = Arrays.asList(SalaryArchiveStatusEnum.STOP_FROM_PENDING.getValue(), SalaryArchiveStatusEnum.STOP_FROM_SUSPEND.getValue());
// List<SalaryArchivePO> salaryArchiveAddTodoList = Lists.newArrayList();
// List<SalaryArchivePO> salaryArchiveUpdateTodoList = Lists.newArrayList();
// List<SalaryArchiveItemPO> salaryArchiveItemAddTodos = Lists.newArrayList();
//
// Map<String, SalaryArchivePO> salaryArchiveListMap = SalaryEntityUtil.convert2Map(salaryArchiveList, k -> k.getTaxAgentId() + "-" + k.getEmployeeId());
// taxAgentEmpChanges.forEach(change -> {
// SalaryArchivePO salaryArchive = salaryArchiveListMap.get(change.getTaxAgentId() + "-" + change.getEmployeeId());
// // 如果是新增 说明如果没有档案则新增如果有档案而且是停薪就挪到待定薪中以个税扣缴义务人和人员id判断唯一
// if (change.getChangeType() == TaxAgentEmpChangeTypeEnum.ADD.getValue()) {
// if (salaryArchive != null) {
// // 停薪中跳回待定薪从a调动到b又调动到a或者是删除待办后再覆盖
// if (stopStatus.contains(salaryArchive.getRunStatus())) {
// // 跳回待定薪
// salaryArchive.setRunStatus(SalaryArchiveStatusEnum.PENDING.getValue());
// if (salaryArchive.getRunStatus().equals(SalaryArchiveStatusEnum.STOP_FROM_SUSPEND.getValue())) {
// salaryArchive.setPayStartDate(today);
// salaryArchive.setPayEndDate(null);
// }
// salaryArchiveUpdateTodoList.add(salaryArchive);
// // 待停薪到停薪的就要复制最新的薪资项目
// if (salaryArchive.getRunStatus().equals(SalaryArchiveStatusEnum.STOP_FROM_SUSPEND.getValue())) {
// // 拷贝最新的薪资项目数据
// List<SalaryArchiveItemPO> salaryArchiveItemValuelList = salaryArchiveItemList.stream().filter(i -> i.getSalaryArchiveId().equals(salaryArchive.getId())).collect(Collectors.toList());
// salaryArchiveItemValuelList.forEach(i -> {
// salaryArchiveItemAddTodos.add(SalaryArchiveItemPO.builder()
// .id(IdGenerator.generate())
// .salaryArchiveId(salaryArchive.getId())
// .employeeId(salaryArchive.getEmployeeId())
// .effectiveTime(today)
// .adjustReason(SalaryArchiveItemAdjustReasonEnum.INIT.getValue())
// .salaryItemId(i.getSalaryItemId())
// .itemValue(i.getItemValue())
// .description("")
// // 不用设置操作人
// .operateTime(now)
// .createTime(now)
// .updateTime(now)
// .creator(currentEmployeeId)
// .deleteType(NumberUtils.INTEGER_ZERO)
// .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
// .build());
// });
// }
// }
// } else {
// salaryArchiveAddTodoList.add(SalaryArchivePO.builder()
// .id(IdGenerator.generate())
// .employeeId(change.getEmployeeId())
// .taxAgentId(change.getTaxAgentId())
// .employeeType(change.getEmployeeType())
// .runStatus(SalaryArchiveStatusEnum.PENDING.getValue())
// // .incomeCategory(IncomeCategoryEnum.WAGES_AND_SALARIES.getValue())
// // .modifier(0L)
// .createTime(now)
// .updateTime(now)
// .creator(currentEmployeeId)
// .deleteType(NumberUtils.INTEGER_ZERO)
// .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
// .build());
// }
// // 如果是删除 说明如果有档案并且是在定薪列表才处理没档案不用管
// } else if (change.getChangeType() == TaxAgentEmpChangeTypeEnum.DEL.getValue()) {
// if (salaryArchive != null) {
// if (salaryArchive.getRunStatus().equals(SalaryArchiveStatusEnum.FIXED.getValue())) {
// // 跳到待停薪
// salaryArchive.setRunStatus(SalaryArchiveStatusEnum.SUSPEND.getValue());
// // salaryArchive.setPayEndDate(today);
// salaryArchiveUpdateTodoList.add(salaryArchive);
// } else if (salaryArchive.getRunStatus().equals(SalaryArchiveStatusEnum.PENDING.getValue())) {
// // 跳到停薪
// salaryArchive.setRunStatus(SalaryArchiveStatusEnum.STOP_FROM_PENDING.getValue());
// salaryArchiveUpdateTodoList.add(salaryArchive);
// }
// }
// }
// });
//
// return ChangeData.builder()
// .salaryArchiveAddTodoList(salaryArchiveAddTodoList)
// .salaryArchiveUpdateTodoList(salaryArchiveUpdateTodoList)
// .salaryArchiveItemAddTodos(salaryArchiveItemAddTodos)
// .changeIds(changeIds)
// .build();
// }
//
// @Data
// @Builder
// @NoArgsConstructor
// @AllArgsConstructor
// public static class ChangeData {
//
// /**
// * 批量修改薪资档案
// */
// private List<SalaryArchivePO> salaryArchiveAddTodoList;
//
// /**
// * 批量新增薪资档案
// */
// private List<SalaryArchivePO> salaryArchiveUpdateTodoList;
//
// /**
// * 落库处理薪资项目
// */
// private List<SalaryArchiveItemPO> salaryArchiveItemAddTodos;
//
// /**
// * 删除增量数据
// */
// private List<Long> changeIds;
// }
}

View File

@ -0,0 +1,315 @@
package com.engine.salary.entity.datacollection.bo;
import com.engine.core.impl.Service;
import com.engine.salary.constant.SalaryArchiveConstant;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.datacollection.param.VariableArchiveImportHandleParam;
import com.engine.salary.entity.datacollection.po.VariableArchiveItemPO;
import com.engine.salary.entity.datacollection.po.VariableArchivePO;
import com.engine.salary.entity.datacollection.po.VariableItemPO;
import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO;
import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.enums.salaryarchive.SalaryArchiveFieldTypeEnum;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.IdGenerator;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import weaver.general.Util;
import weaver.hrm.User;
import java.util.*;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
* @Description: 浮动薪资档案-excel
* @Author: xzy
* @Date: 2024-08-08 10:51
*/
public class VariableArchiveExcelBO extends Service {
public static String userNameI18n;
public static String departmentI18n;
public static String jobNumI18n;
public static String hrStatusI18n;
public static String repeatMsg;
public static String taxAgentI18n;
public static String taxAgentRangeMsg;
public static String empRepeatMsg;
public static String notEmptyI18n;
public static String incomeCategoryI18n;
public static String salarySobI18n;
public static String effectiveTimeI18n;
public static String payStartDateI18n;
public static String payEndDateI18n;
public static String adjustReasonI18n;
public static String listTypeErrMsg;
public static String taxAgentNoExist;
public static String incomeCategoryNoExist;
public static String currSalarySobI18n;
public static String noExist;
public static String effectiveTimeErr;
public static String adjustReasonNoExist;
public static String dateErr;
public static String payStartUnableAfterEnd;
public static String salaryItemNoBeforeCurrentEffectiveTime;
public static String salaryItemAdjustNoSame;
public static String salaryItemAdjustNoSameIneffective;
public static String salaryArchiveErr;
public static String numberErr;
/**
* 初始化i18n
*/
public static void initI18n() {
userNameI18n = SalaryI18nUtil.getI18nLabel(85429, "姓名");
departmentI18n = SalaryI18nUtil.getI18nLabel(86185, "部门");
jobNumI18n = SalaryI18nUtil.getI18nLabel(86317, "工号");
hrStatusI18n = SalaryI18nUtil.getI18nLabel(109332, "人事状态");
repeatMsg = "[" + Joiner.on(",").join(new List[]{Arrays.asList(userNameI18n, departmentI18n, jobNumI18n, hrStatusI18n)}) + "]";
taxAgentI18n = SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人");
taxAgentRangeMsg = SalaryI18nUtil.getI18nLabel(132633, "该员工不在该个税扣缴义务人的人员范围中") + "," + SalaryI18nUtil.getI18nLabel(127308, "请检查") + repeatMsg;
empRepeatMsg = SalaryI18nUtil.getI18nLabel(121899, "员工信息重复,请检查") + repeatMsg;
notEmptyI18n = SalaryI18nUtil.getI18nLabel(100577, "不能为空");
incomeCategoryI18n = SalaryI18nUtil.getI18nLabel(121908, "收入所得项目");
salarySobI18n = SalaryI18nUtil.getI18nLabel(87889, "薪资账套");
effectiveTimeI18n = SalaryI18nUtil.getI18nLabel(85904, "生效日期");
payStartDateI18n = SalaryI18nUtil.getI18nLabel(109527, "起始发薪日期");
payEndDateI18n = SalaryI18nUtil.getI18nLabel(109329, "最后发薪日期");
adjustReasonI18n = SalaryI18nUtil.getI18nLabel(85431, "调整原因");
listTypeErrMsg = SalaryI18nUtil.getI18nLabel(115527, "该条数据不符合当前列表导入要求或其他列表存在该档案,不可导入");
taxAgentNoExist = SalaryI18nUtil.getI18nLabel(100545, "个税扣缴义务人不存在");
incomeCategoryNoExist = SalaryI18nUtil.getI18nLabel(121923, "收入所得项目不存在");
currSalarySobI18n = SalaryI18nUtil.getI18nLabel(127213, "该收入所得项目");
noExist = SalaryI18nUtil.getI18nLabel(127236, "不存在");
effectiveTimeErr = SalaryI18nUtil.getI18nLabel(102497, "生效日期错误或格式不正确,正确格式示例为'2022-01-01'、'2022/1/1'");
adjustReasonNoExist = SalaryI18nUtil.getI18nLabel(100591, "调整原因不存在");
dateErr = SalaryI18nUtil.getI18nLabel(109819, "日期错误或格式不正确,正确格式示例为'2022-01-01'、'2022/1/1'");
payStartUnableAfterEnd = SalaryI18nUtil.getI18nLabel(109214, "起始发薪日期不可晚于最后发薪日");
salaryItemNoBeforeCurrentEffectiveTime = SalaryI18nUtil.getI18nLabel(100429, "生效日期不可早于当前已生效的调整日期");
salaryItemAdjustNoSame = SalaryI18nUtil.getI18nLabel(100432, "调整前后不可相同");
salaryItemAdjustNoSameIneffective = SalaryI18nUtil.getI18nLabel(100434, "与未生效的调整后不可相同");
salaryArchiveErr = SalaryI18nUtil.getI18nLabel(101723, "该员工的薪资档案记录有误,请检查");
numberErr = SalaryI18nUtil.getI18nLabel(100581, "请输入数字");
}
/**
* 校验单行数据
*
* @param map
* @param headers
* @param excelComments
* @param errorCount
* @param importHandleParam
* @return
*/
public static boolean singleRowCheck(List<String> allTodoVariableArchives,
Map<String, Object> map,
List<String> headers,
List<Map<String, String>> excelComments,
int errorCount,
VariableArchiveImportHandleParam importHandleParam,
User user) {
boolean isError = false;
String rowindex = "" + map.get("index") + "";
// 1.姓名
String userName = Optional.ofNullable(map.get(userNameI18n)).orElse("").toString();
String deparmentName = Optional.ofNullable(map.get(departmentI18n)).orElse("").toString();
String mobileName = Optional.ofNullable(map.get("手机号")).orElse("").toString();
String workcode = Optional.ofNullable(map.get("工号")).orElse("").toString();
String idNo = Optional.ofNullable(map.get("证件号码")).orElse("").toString();
String validType = importHandleParam.getEmpValidType();
List<DataCollectionEmployee> emps = new ArrayList<>();
if ("0".equals(validType)) {
//0代表姓名+部门+手机号的匹配原则1代表工号为唯一匹配原则
emps = importHandleParam.getEmployees().stream().filter(e ->
(StringUtils.isBlank(userName) || Objects.equals(e.getUsername(), userName))
&& (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName))
&& (StringUtils.isBlank(mobileName) || Objects.equals(e.getMobile(), mobileName))).collect(Collectors.toList());
} else if ("1".equals(validType)) {
emps = importHandleParam.getEmployees().stream().filter(e -> (StringUtils.isBlank(workcode) || Objects.equals(e.getWorkcode(), workcode)))
.collect(Collectors.toList());
}
else if ("2".equals(validType)) {
emps = importHandleParam.getEmployees().stream().filter(e -> (StringUtils.isBlank(idNo) || Objects.equals(e.getIdNo(), idNo)))
.collect(Collectors.toList());
}
List<Long> employeeSameIds = new ArrayList<>();
if (CollectionUtils.isNotEmpty(emps) && emps.size() > 1) {
employeeSameIds = emps.stream().filter(e -> UserStatusEnum.getNormalStatus().contains(e.getStatus())).map(DataCollectionEmployee::getEmployeeId).collect(Collectors.toList());
}
if (CollectionUtils.isNotEmpty(emps) && emps.size() == 1) {
employeeSameIds = emps.stream().map(DataCollectionEmployee::getEmployeeId).collect(Collectors.toList());
}
Long employeeId = CollectionUtils.isNotEmpty(employeeSameIds) && employeeSameIds.size() == 1 && employeeSameIds.get(0) > 0 ? employeeSameIds.get(0) : null;
if (employeeId == null) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowindex + "查找人员失败,请确定姓名、部门、手机号正确且唯一");
excelComments.add(errorMessageMap);
isError = true;
return isError;
}
// 个税扣缴义务人
String taxAgentCellVal = Optional.ofNullable(map.get(taxAgentI18n)).orElse("").toString();
map.put("taxAgent", taxAgentCellVal);
Optional<TaxAgentManageRangeEmployeeDTO> optionalTaxAgent = importHandleParam.getTaxAgentList().stream().filter(m -> m.getTaxAgentName().equals(taxAgentCellVal)).findFirst();
if (!optionalTaxAgent.isPresent()) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowindex + "个税扣缴义务人不存在,或不在权限范围内");
excelComments.add(errorMessageMap);
isError = true;
return isError;
}
Long taxAgentId = optionalTaxAgent.get().getTaxAgentId();
map.put("taxAgentId", taxAgentId);
// 用于初始化导入数据校验
map.put("employeeId", employeeId);
String repeatKey = optionalTaxAgent.get().getTaxAgentId() + "-" + employeeId.toString();
if (allTodoVariableArchives.contains(repeatKey)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowindex + "存在重复数据");
excelComments.add(errorMessageMap);
isError = true;
return isError;
} else {
allTodoVariableArchives.add(repeatKey);
}
// 构建薪资档案
VariableArchivePO finalVariableArchive = buildVariableArchive(employeeId, taxAgentId, importHandleParam);
map.put("variableArchiveId", finalVariableArchive.getId());
List<Long> needDelArchiveItemIds = new ArrayList<>();
for (int j = 0; j < headers.size(); j++) {
String header = headers.get(j);
Object key = header;
if (key == null) {
continue;
}
String cellVal = Optional.ofNullable(map.get(key.toString())).orElse("").toString();
boolean isNotEmpty = StringUtils.isNotEmpty(cellVal);
// 1.姓名列处理
if (isNotEmpty && userNameI18n.equals(key.toString())) {
if (CollectionUtils.isEmpty(employeeSameIds) || employeeSameIds.size() > 1) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowindex + header + empRepeatMsg);
excelComments.add(errorMessageMap);
isError = true;
}
} else {
// 浮动薪资项目数据
if (!isError) {
Optional<VariableItemPO> optionalVariableItem = importHandleParam.getVariableItems().stream().filter(e -> Util.formatMultiLang(e.getName(), String.valueOf(user.getLanguage())).equals(key)).findFirst();
if (optionalVariableItem.isPresent()) {
VariableItemPO variableItemPO = optionalVariableItem.get();
// 数值类型判断
boolean isNotNumber = variableItemPO.getDataType().equals(SalaryArchiveFieldTypeEnum.NUMBER.getValue()) && StringUtils.isNotEmpty(cellVal) && !Pattern.matches(SalaryArchiveConstant.NUMBER_REGEX, cellVal);
if (isNotNumber) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowindex + key + numberErr);
excelComments.add(errorMessageMap);
isError = true;
}
Long variableItemId = variableItemPO.getId();
// 已生效
List<VariableArchiveItemPO> effectiveList = Optional.ofNullable(importHandleParam.getEffectiveItemListMap().get(finalVariableArchive.getId() + "-" + variableItemId)).orElse(Lists.newArrayList());
// 先删除后新增
needDelArchiveItemIds.addAll(effectiveList.stream().map(VariableArchiveItemPO::getId).collect(Collectors.toList()));
// 导入时不需要处理的项目
boolean isInitNull = CollectionUtils.isEmpty(effectiveList) && StringUtils.isEmpty(cellVal);
if (!isError && !isInitNull && StringUtils.isNotBlank(cellVal)) {
importHandleParam.getVariableArchiveItemSaves().add(VariableArchiveItemPO.builder()
.id(IdGenerator.generate())
.employeeId(finalVariableArchive.getEmployeeId())
.variableArchiveId(finalVariableArchive.getId())
.variableItemId(variableItemId)
.itemValue(cellVal)
.creator(importHandleParam.getCurrentEmployeeId())
.createTime(importHandleParam.getNowTime())
.updateTime(importHandleParam.getNowTime())
.deleteType(NumberUtils.INTEGER_ZERO)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build());
}
}
}
}
}
// 如果当前校验行没问题,修改起始发薪日期和最终发薪日期等
if (isError) {
// 将前面添加好的数据给过滤掉
importHandleParam.setVariableArchiveSaves(importHandleParam.getVariableArchiveSaves().stream().filter(f -> !finalVariableArchive.getId().equals(f.getId())).collect(Collectors.toList()));
importHandleParam.setVariableArchiveItemSaves(importHandleParam.getVariableArchiveItemSaves().stream().filter(f -> !finalVariableArchive.getId().equals(f.getVariableArchiveId())).collect(Collectors.toList()));
} else {
importHandleParam.getVariableArchiveItemDelSalaryItemIds().addAll(needDelArchiveItemIds);
}
return isError;
}
/**
* 构建浮动薪资档案对象
*
* @param employeeId
* @param taxAgentId
* @param importHandleParam
* @return
*/
public static VariableArchivePO buildVariableArchive(Long employeeId, Long taxAgentId, VariableArchiveImportHandleParam importHandleParam) {
VariableArchivePO variableArchivePO = importHandleParam.getVariableArchivesMap().get(taxAgentId + "-" + employeeId);
if (variableArchivePO == null) {
// 新增浮动档案
variableArchivePO = VariableArchivePO.builder()
.id(IdGenerator.generate())
.employeeId(employeeId)
.taxAgentId(taxAgentId)
.salaryMonth(importHandleParam.getSalaryMonthDate())
.createTime(importHandleParam.getNowTime())
.updateTime(importHandleParam.getNowTime())
.creator(importHandleParam.getCurrentEmployeeId())
.deleteType(NumberUtils.INTEGER_ZERO)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build();
importHandleParam.getVariableArchiveSaves().add(variableArchivePO);
}
return variableArchivePO;
}
@Override
public String toString() {
return "SalaryArchiveExcelBO{}";
}
}

View File

@ -0,0 +1,33 @@
package com.engine.salary.entity.datacollection.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 浮动薪酬档案明细
* <p>Copyright: Copyright (c) 2024</p>
* <p>Company: 泛微软件</p>
*
* @author xzy
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class VariableArchiveItemDTO {
private Long id;
/**
* 浮动项目id
*/
private Long variableItemId;
/**
* 浮动值
*/
private String itemValue;
}

View File

@ -0,0 +1,99 @@
package com.engine.salary.entity.datacollection.dto;
import com.cloudstore.eccom.pc.table.WeaTableType;
import com.engine.salary.annotation.I18n;
import com.engine.salary.annotation.SalaryTable;
import com.engine.salary.annotation.TableTitle;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 浮动薪资档案列表
* <p>Copyright: Copyright (c) 2024</p>
* <p>Company: 泛微软件</p>
*
* @author xzy
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@SalaryTable(pageId = "bd985583-f84j-p2aj-p288-2hw3hosy6r6,", tableType = WeaTableType.CHECKBOX)
public class VariableArchiveListDTO {
@TableTitle(title = "id", dataIndex = "id", key = "id")
private Long id;
@TableTitle(title = "人员信息表的主键id", dataIndex = "employeeId", key = "employeeId")
private Long employeeId;
private Date salaryMonth;
/**
* 个税扣缴义务人
*/
@TableTitle(title = "个税扣缴义务人", dataIndex = "taxAgentName", key = "taxAgentName")
@I18n
private String taxAgentName;
/**
* 个税扣缴义务人id
*/
private Long taxAgentId;
/**
* 姓名
*/
@TableTitle(title = "姓名", dataIndex = "username", key = "username")
@I18n
private String username;
/**
* 分部
*/
@TableTitle(title = "分部", dataIndex = "subcompanyName", key = "subcompanyName")
@I18n
private String subcompanyName;
/**
* 部门
*/
@TableTitle(title = "部门", dataIndex = "departmentName", key = "departmentName")
@I18n
private String departmentName;
/**
* 电话
*/
@TableTitle(title = "电话", dataIndex = "mobile", key = "mobile")
private String mobile;
/**
* 工号
*/
@TableTitle(title = "工号", dataIndex = "workcode", key = "workcode")
private String workcode;
/**
* 证件号码
*/
@TableTitle(title = "证件号码", dataIndex = "idNo", key = "idNo")
private String idNo;
/**
* 入职日期
*/
private String companystartdate;
/**
* 离职日期
*/
private String dismissdate;
}

View File

@ -0,0 +1,37 @@
package com.engine.salary.entity.datacollection.dto;
import com.engine.salary.annotation.TableTitle;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 浮动薪资项目列表
* <p>Copyright: Copyright (c) 2024</p>
* <p>Company: 泛微软件</p>
*
* @author xzy
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class VariableItemListDTO {
@TableTitle(title = "id", dataIndex = "id", key = "id")
private Long id;
@TableTitle(title = "项目名称", dataIndex = "name", key = "name")
private String name;
@TableTitle(title = "字段类型", dataIndex = "dataType", key = "dataType")
private String dataType;
/**
* 是否可删除
*/
private boolean canDelete;
}

View File

@ -0,0 +1,104 @@
package com.engine.salary.entity.datacollection.param;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.datacollection.po.VariableArchiveItemPO;
import com.engine.salary.entity.datacollection.po.VariableArchivePO;
import com.engine.salary.entity.datacollection.po.VariableItemPO;
import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 数据采集-浮动薪酬导入参数
* <p>Copyright: Copyright (c) 2024</p>
* <p>Company: 泛微软件</p>
*
* @author xzy
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class VariableArchiveImportHandleParam {
// 上传文件id
String imageId;
// 薪资所属月
String salaryMonth;
Date salaryMonthDate;
// ---------------------------
Long currentEmployeeId;
String tenantKey;
/**
* 人员验证方式
*/
String empValidType;
/**
* 获取租户下所有的人员
*/
List<DataCollectionEmployee> employees;
/**
* 获取所有可被引用的浮动薪资项目
*/
List<VariableItemPO> variableItems;
/**
* 查询已有的浮动薪资档案基本数据
*/
Map<String, VariableArchivePO> variableArchivesMap;
/**
* 浮动薪资项目id
*/
Collection<Long> variableItemIds;
/**
* 查询已生效的浮动薪资项目数据
*/
Map<String, List<VariableArchiveItemPO>> effectiveItemListMap;
/**
* 获取所有个税扣缴义务人
*/
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList;
/**
* 当前时间
*/
Date nowTime = new Date();
/**
* 当天
*/
Date today = new Date();
/**
* 待保存浮动薪资档案
*/
List<VariableArchivePO> variableArchiveSaves;
/**
* 待保存浮动薪资档案-浮动薪资项目
*/
List<VariableArchiveItemPO> variableArchiveItemSaves;
/**
* 待删除浮动薪资档案-浮动薪资项目
*/
List<Long> variableArchiveItemDelSalaryItemIds;
}

View File

@ -0,0 +1,52 @@
package com.engine.salary.entity.datacollection.param;
import com.engine.salary.common.BaseQueryParam;
import com.engine.salary.util.valid.DataCheck;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Collection;
import java.util.Date;
import java.util.List;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//数据采集-浮动薪酬查询参数
public class VariableArchiveQueryParam extends BaseQueryParam {
// 主键id
private Collection<Long> ids;
// 主键id
private Long id;
// 个税扣缴义务人
private List<Long> taxAgentIds;
// 薪资年月
@DataCheck(require = true,message = "薪资所属月不能为空")
private String salaryMonth;
private Date salaryMonthDate;
// 姓名
private String username;
// 部门id
private List<Long> departmentIds;
// 工号
private String workcode;
// 下载模板是否带数据
private boolean hasData;
private List<Long> employeeIds;
private List<String> columns;
}

View File

@ -0,0 +1,38 @@
package com.engine.salary.entity.datacollection.param;
import com.engine.salary.entity.datacollection.dto.VariableArchiveItemDTO;
import com.engine.salary.util.valid.DataCheck;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.List;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//数据采集-浮动薪酬档案保存参数
public class VariableArchiveSaveParam {
// 主键id
private Long id;
// 薪资年月
@DataCheck(require = true,message = "薪资所属月不能为空")
private String salaryMonth;
@DataCheck(require = true,message = "义务人id不能为空")
private Long taxAgentIds;
private Date salaryMonthDate;
// 人员id
private Long employeeId;
// 浮动值
private List<VariableArchiveItemDTO> itemValueList;
}

View File

@ -0,0 +1,31 @@
package com.engine.salary.entity.datacollection.param;
import com.engine.salary.common.BaseQueryParam;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
// 浮动薪酬项目查询参数
public class VariableItemQueryParam extends BaseQueryParam {
/**
* 浮动薪酬项目名称
*/
private String itemName;
private Long id;
/**
* 项目ids
*/
private List<Long> itemIds;
}

View File

@ -0,0 +1,41 @@
package com.engine.salary.entity.datacollection.param;
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
import com.engine.salary.util.valid.DataCheck;
import com.engine.salary.util.valid.RuntimeTypeEnum;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* <p>Copyright: Copyright (c) 2024</p>
* <p>Company: 泛微软件</p>
*
* @author xzy
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class VariableItemSaveParam {
//主键id
@JsonSerialize(using = ToStringSerializer.class)
@DataCheck(require = true, runtime = {RuntimeTypeEnum.UPDATE}, message = "id不允许为空")
private Long id;
//名称
@DataCheck(require = true, max = 40, message = "名称不允许为空,名称不能超过40个字符")
private String name;
/**
* 字段类型
* @see SalaryDataTypeEnum
*/
@DataCheck(require = true, message = "字段类型不允许为空")
private String dataType;
}

View File

@ -0,0 +1,76 @@
package com.engine.salary.entity.datacollection.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Collection;
import java.util.Date;
/**
* @author Harryxzy
* @ClassName VariableArchiveItemPO
* @date 2024/08/07 9:15
* @description 浮动薪酬档案明细
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class VariableArchiveItemPO {
private Long id;
/**
* 员工id
*/
private Long employeeId;
/**
* 浮动薪资档案主键id
*/
private Long variableArchiveId;
/**
* 浮动项目id
*/
private Long variableItemId;
/**
* 浮动值
*/
private String itemValue;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 创建人
*/
private Long creator;
/**
* 是否已删除0未删除1已删除
*/
private Integer deleteType;
/**
* 租户ID
*/
private String tenantKey;
//主键id集合
private Collection<Long> ids;
private Collection<Long> variableArchiveIds;
}

View File

@ -0,0 +1,51 @@
package com.engine.salary.entity.datacollection.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Collection;
import java.util.Date;
/**
* @author Harryxzy
* @ClassName VariableArchivePO
* @date 2024/08/07 9:16
* @description 浮动薪酬档案
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class VariableArchivePO {
private Long id;
/**
* 人员id
*/
private Long employeeId;
private Long taxAgentId;
/**
* 薪资月份
*/
private Date salaryMonth;
private Date createTime;
private Date updateTime;
private Long creator;
private Integer deleteType;
private String tenantKey;
//主键id集合
private Collection<Long> ids;
}

View File

@ -0,0 +1,58 @@
package com.engine.salary.entity.datacollection.po;
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Collection;
import java.util.Date;
/**
* @author Harryxzy
* @ClassName VariableItemPO
* @date 2024/08/07 9:14
* @description 浮动薪酬项目
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class VariableItemPO {
/**
* 浮动项目id
*/
private Long id;
/**
* 浮动项目名称
*/
private String name;
private String code;
/**
* 字段类型string字符number数字
*
* @see SalaryDataTypeEnum
*/
private String dataType;
private Date createTime;
private Date updateTime;
private Long creator;
private Integer deleteType;
private String tenantKey;
//主键id集合
private Collection<Long> ids;
}

View File

@ -4,6 +4,7 @@ import cn.hutool.core.util.NumberUtil;
import com.engine.salary.annotation.SalaryFormulaVar;
import com.engine.salary.common.LocalDateRange;
import com.engine.salary.constant.SalaryFormulaFieldConstant;
import com.engine.salary.constant.SalaryItemConstant;
import com.engine.salary.entity.datacollection.AddUpDeduction;
import com.engine.salary.entity.datacollection.AddUpSituation;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
@ -98,6 +99,11 @@ public class CalculateFormulaVarBO {
*/
private List<SalaryAcctResultPO> salaryAcctResultPOS;
/**
* 浮动薪资档案
*/
private List<Map<String, Object>> variableArchiveList;
public CalculateFormulaVarBO(List<DataCollectionEmployee> simpleEmployees,
List<SalaryArchiveDataDTO> salaryArchiveData,
List<AddUpSituation> addUpSituationPOS,
@ -105,7 +111,8 @@ public class CalculateFormulaVarBO {
List<OtherDeductionPO> otherDeductionPOS,
List<Map<String, Object>> welfareData,
List<AttendQuoteDataDTO> attendQuoteDataDTOS,
List<SalaryAcctResultPO> salaryAcctResultPOS) {
List<SalaryAcctResultPO> salaryAcctResultPOS,
List<Map<String, Object>> variableArchiveList) {
this.simpleEmployees = simpleEmployees;
this.salaryArchiveData = salaryArchiveData;
this.addUpSituationPOS = addUpSituationPOS;
@ -114,6 +121,7 @@ public class CalculateFormulaVarBO {
this.welfareData = welfareData;
this.attendQuoteDataDTOS = attendQuoteDataDTOS;
this.salaryAcctResultPOS = salaryAcctResultPOS;
this.variableArchiveList = variableArchiveList;
}
/**
@ -128,6 +136,8 @@ public class CalculateFormulaVarBO {
handleSalaryAcctResult(salaryAcctCalculateBO, resultMap);
// 处理薪资档案
handleSalaryArchiveData(salaryAcctCalculateBO, resultMap);
// 处理浮动薪资档案
handleVariableArchiveData(salaryAcctCalculateBO, resultMap);
// 处理往期累计情况
handleAddUpSituation(resultMap);
// 处理累计专项附加扣除
@ -245,6 +255,27 @@ public class CalculateFormulaVarBO {
}
}
private void handleVariableArchiveData(SalaryAcctCalculateBO salaryAcctCalculateBO, Map<String, List<FormulaVarValue>> resultMap) {
Map<String, Map<String, Object>> variableArchiveMap = SalaryEntityUtil.convert2Map(variableArchiveList, map -> map.getOrDefault("taxAgentIds", "").toString() + "-" + map.getOrDefault("employeeId", "").toString());
// 填充到返回结果集中
for (SalaryAcctEmployeePO salaryAcctEmployeePO : salaryAcctCalculateBO.getSalaryAcctEmployeePOS()) {
List<FormulaVarValue> formulaVarValues = resultMap.computeIfAbsent(salaryAcctEmployeePO.getEmployeeId() + "_" + salaryAcctEmployeePO.getTaxAgentId(),
k -> Lists.newArrayList());
String key = salaryAcctEmployeePO.getTaxAgentId().toString() + "-" + salaryAcctEmployeePO.getEmployeeId().toString();
Map<String, Object> map = variableArchiveMap.getOrDefault(key, Collections.emptyMap());
formulaVarValues.addAll(salaryAcctCalculateBO.getVariableItems().stream().map(field -> {
String fieldId = SalaryFormulaReferenceEnum.VARIABLE_ITEM.getValue()
+ SalaryFormulaFieldConstant.FIELD_ID_SEPARATOR
+ field.getCode();
String value = map.getOrDefault(field.getId() + SalaryItemConstant.VARIABLE_ITEM_DYNAMIC_SUFFIX, StringUtils.EMPTY) == null ? StringUtils.EMPTY
: map.getOrDefault(field.getId() + SalaryItemConstant.VARIABLE_ITEM_DYNAMIC_SUFFIX, StringUtils.EMPTY).toString();
return new FormulaVarValue().setFieldId(fieldId).setFieldValue(value);
}).collect(Collectors.toList()));
}
}
/**
* 根据调薪计薪规则处理薪资档案的调薪转换成公式编辑器中的变量
*

View File

@ -1,6 +1,7 @@
package com.engine.salary.entity.salaryacct.bo;
import com.engine.salary.entity.datacollection.dto.AttendQuoteFieldListDTO;
import com.engine.salary.entity.datacollection.po.VariableItemPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
@ -130,6 +131,11 @@ public class SalaryAcctCalculateBO {
*/
private TaxDeclarationFunctionEnum taxDeclarationFunction;
/**
* 浮动薪资字段
*/
private List<VariableItemPO> variableItems;
@Data
@AllArgsConstructor
public static class Result {

View File

@ -63,9 +63,9 @@ public class SalaryAcctEmployeeBO {
.employeeName(simpleEmployee.getUsername())
.taxAgentId(e.getTaxAgentId())
.taxAgentName(taxAgentNameMap.getOrDefault(e.getTaxAgentId(), StringUtils.EMPTY))
.departmentId(simpleEmployee.getDepartmentId())
.departmentName(simpleEmployee.getDepartmentName())
.status(UserStatusEnum.getDefaultLabelByValue(NumberUtils.toInt(simpleEmployee.getStatus())))
.departmentId(e.getDepartmentId())
.departmentName(e.getDepartmentName())
.status(UserStatusEnum.getDefaultLabelByValue(NumberUtils.toInt(e.getStatus())))
.mobile(simpleEmployee.getMobile())
.jobNum(simpleEmployee.getWorkcode())
.hireDate(simpleEmployee.getCompanystartdate())

View File

@ -1,6 +1,5 @@
package com.engine.salary.entity.salaryacct.param;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.util.valid.DataCheck;
import lombok.AllArgsConstructor;
import lombok.Builder;
@ -8,7 +7,6 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Collection;
import java.util.Map;
/**
* 薪资核算的参数
@ -29,9 +27,4 @@ public class SalaryAcctCalculateParam {
@DataCheck(require = true,message = "参数错误薪资核算记录ID不能为空")
private Long salaryAcctRecordId;
/**
* 人员信息报表使用
*/
private Map<Long, DataCollectionEmployee> emps;
}

View File

@ -26,6 +26,7 @@ public enum SalaryFormulaReferenceEnum implements BaseEnum<String> {
OTHER_DEDUCTION("otherDeduction", "其他免税扣除", 93849),
SALARY_ACCT_EMPLOYEE("salaryAcctEmployee", "核算基本信息", 85368),
SALARY_CYCLE("SalaryCycle", "核算日期", 85368),
VARIABLE_ITEM("variableItem", "浮动薪资项目", 0),
ISSUED("ISSUED", "已发", 0);
private String value;

View File

@ -8,12 +8,6 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Author weaver_cl
*
* @Date 2022/4/18
* @Version V1.0
**/
public interface InsuranceExportMapper {
List<ExcelAccountExportPO> exportExcelAccount(@Param("param") InsuranceComparisonResultQueryParam param);

View File

@ -0,0 +1,18 @@
package com.engine.salary.mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* SQLMapper
* <p>Copyright: Copyright (c) 2024</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public interface SQLMapper {
List<Map> runSQL(@Param("sql") String sql);
}

View File

@ -0,0 +1,7 @@
<?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.SQLMapper">
<select id="runSQL" resultType="java.util.Map">
${sql}
</select>
</mapper>

View File

@ -104,4 +104,10 @@ public interface AttendQuoteFieldMapper {
* @return
*/
List<AttendQuoteFieldPO> listSome(@Param("param") AttendQuoteFieldPO param);
/**
* 获取出勤班次
* @return
*/
List<String> getAttendanceSerials();
}

View File

@ -486,4 +486,8 @@
</delete>
<select id="getAttendanceSerials" resultType="string">
select id from kq_ShiftManagement where isdelete is null or isdelete <![CDATA[ <> ]]> '1'
</select>
</mapper>

View File

@ -0,0 +1,87 @@
package com.engine.salary.mapper.datacollection;
import com.engine.salary.entity.datacollection.po.VariableArchiveItemPO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author Harryxzy
* @ClassName VariableArchiveItemMapper
* @date 2024/08/07 9:22
* @description 浮动薪酬档案明细
*/
public interface VariableArchiveItemMapper {
/**
* 查询所有记录
*
* @return 返回集合没有返回空List
*/
List<VariableArchiveItemPO> listAll();
/**
* 条件查询
*
* @return 返回集合没有返回空List
*/
List<VariableArchiveItemPO> listSome(@Param("param") VariableArchiveItemPO variableArchiveItem);
/**
* 根据主键查询
*
* @param id 主键
* @return 返回记录没有返回null
*/
VariableArchiveItemPO getById(Long id);
/**
* 新增忽略null字段
*
* @param variableArchiveItem 新增的记录
* @return 返回影响行数
*/
int insertIgnoreNull(VariableArchiveItemPO variableArchiveItem);
/**
* 修改修改所有字段
*
* @param variableArchiveItem 修改的记录
* @return 返回影响行数
*/
int update(VariableArchiveItemPO variableArchiveItem);
/**
* 修改忽略null字段
*
* @param variableArchiveItem 修改的记录
* @return 返回影响行数
*/
int updateIgnoreNull(VariableArchiveItemPO variableArchiveItem);
/**
* 删除记录
*
* @param variableArchiveItem 待删除的记录
* @return 返回影响行数
*/
int delete(VariableArchiveItemPO variableArchiveItem);
/**
* 查询浮动薪酬档案中已使用的浮动薪资项目
*
* @return
*/
List<Long> listUsingItems();
/**
*
* @param insertList
* @return
*/
int batchInsert(@Param("collection") List<VariableArchiveItemPO> insertList);
void deleteByIds(@Param("collection")List<Long> part);
void deleteByArchiveIds(@Param("collection")List<Long> part);
}

View File

@ -0,0 +1,349 @@
<?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.VariableArchiveItemMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.datacollection.po.VariableArchiveItemPO">
<result column="id" property="id" />
<result column="employee_id" property="employeeId" />
<result column="variable_archive_id" property="variableArchiveId" />
<result column="variable_item_id" property="variableItemId" />
<result column="item_value" property="itemValue" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<result column="creator" property="creator" />
<result column="delete_type" property="deleteType" />
<result column="tenant_key" property="tenantKey" />
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t.id
, t.employee_id
, t.variable_archive_id
, t.variable_item_id
, t.item_value
, t.create_time
, t.update_time
, t.creator
, t.delete_type
, t.tenant_key
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns" />
FROM hrsa_variable_archive_item t
WHERE delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns" />
FROM hrsa_variable_archive_item t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.datacollection.po.VariableArchiveItemPO">
SELECT
<include refid="baseColumns" />
FROM hrsa_variable_archive_item t
WHERE delete_type = 0
<if test="param.id != null">
AND id = #{param.id}
</if>
<if test="param.employeeId != null">
AND employee_id = #{param.employeeId}
</if>
<if test="param.variableArchiveId != null">
AND variable_archive_id = #{param.variableArchiveId}
</if>
<if test="param.variableItemId != null">
AND variable_item_id = #{param.variableItemId}
</if>
<if test="param.itemValue != null">
AND item_value = #{param.itemValue}
</if>
<if test="param.createTime != null">
AND create_time = #{param.createTime}
</if>
<if test="param.updateTime != null">
AND update_time = #{param.updateTime}
</if>
<if test="param.creator != null">
AND creator = #{param.creator}
</if>
<if test="param.deleteType != null">
AND delete_type = #{param.deleteType}
</if>
<if test="param.tenantKey != null">
AND tenant_key = #{param.tenantKey}
</if>
<if test="param.ids != null and param.ids.size()>0">
AND id IN
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<if test="param.variableArchiveIds != null and param.variableArchiveIds.size()>0">
AND variable_archive_id IN
<foreach collection="param.variableArchiveIds" open="(" item="varArchId" separator="," close=")">
#{varArchId}
</foreach>
</if>
ORDER BY id DESC
</select>
<select id="listUsingItems" resultType="java.lang.Long">
select distinct variable_item_id
from hrsa_variable_archive_item
where delete_type = 0
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.datacollection.po.VariableArchiveItemPO">
INSERT INTO hrsa_variable_archive_item
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="employeeId != null">
employee_id,
</if>
<if test="variableArchiveId != null">
variable_archive_id,
</if>
<if test="variableItemId != null">
variable_item_id,
</if>
<if test="itemValue != null">
item_value,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="tenantKey != null">
tenant_key,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="id != null" >
#{id},
</if>
<if test="employeeId != null" >
#{employeeId},
</if>
<if test="variableArchiveId != null" >
#{variableArchiveId},
</if>
<if test="variableItemId != null" >
#{variableItemId},
</if>
<if test="itemValue != null" >
#{itemValue},
</if>
<if test="createTime != null" >
#{createTime},
</if>
<if test="updateTime != null" >
#{updateTime},
</if>
<if test="creator != null" >
#{creator},
</if>
<if test="deleteType != null" >
#{deleteType},
</if>
<if test="tenantKey != null" >
#{tenantKey},
</if>
</trim>
</insert>
<insert id="batchInsert">
INSERT INTO hrsa_variable_archive_item (
id
, employee_id
, variable_archive_id
, variable_item_id
, item_value
, create_time
, update_time
, creator
, delete_type
, tenant_key
)
VALUES
<foreach collection="collection" item="item" separator=",">
(
#{item.id},
#{item.employeeId},
#{item.variableArchiveId},
#{item.variableItemId},
#{item.itemValue},
#{item.createTime},
#{item.updateTime},
#{item.creator},
#{item.deleteType},
#{item.tenantKey}
)
</foreach>
</insert>
<insert id="batchInsert" databaseId="oracle">
INSERT INTO hrsa_variable_archive_item (
id
, employee_id
, variable_archive_id
, variable_item_id
, item_value
, create_time
, update_time
, creator
, delete_type
, tenant_key
)
<foreach collection="collection" item="item" separator="union all">
select
#{item.id,jdbcType=DOUBLE},
#{item.employeeId,jdbcType=DOUBLE},
#{item.variableArchiveId,jdbcType=DOUBLE},
#{item.variableItemId,jdbcType=DOUBLE},
#{item.itemValue,jdbcType=VARCHAR},
#{item.createTime,jdbcType=DATE},
#{item.updateTime,jdbcType=DATE},
#{item.creator,jdbcType=DOUBLE},
#{item.deleteType,jdbcType=INTEGER},
#{item.tenantKey,jdbcType=VARCHAR}
from dual
</foreach>
</insert>
<insert id="batchInsert" databaseId="sqlserver">
<foreach collection="collection" item="item" separator=";">
INSERT INTO hrsa_variable_archive_item (
id
, employee_id
, variable_archive_id
, variable_item_id
, item_value
, create_time
, update_time
, creator
, delete_type
, tenant_key
)
VALUES
(
#{item.id},
#{item.employeeId},
#{item.variableArchiveId},
#{item.variableItemId},
#{item.itemValue},
#{item.createTime},
#{item.updateTime},
#{item.creator},
#{item.deleteType},
#{item.tenantKey}
)
</foreach>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.entity.datacollection.po.VariableArchiveItemPO">
UPDATE hrsa_variable_archive_item
<set>
employee_id=#{employeeId},
variable_archive_id=#{variableArchiveId},
variable_item_id=#{variableItemId},
item_value=#{itemValue},
create_time=#{createTime},
update_time=#{updateTime},
creator=#{creator},
delete_type=#{deleteType},
tenant_key=#{tenantKey},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.datacollection.po.VariableArchiveItemPO">
UPDATE hrsa_variable_archive_item
<set>
<if test="employeeId != null" >
employee_id=#{employeeId},
</if>
<if test="variableArchiveId != null" >
variable_archive_id=#{variableArchiveId},
</if>
<if test="variableItemId != null" >
variable_item_id=#{variableItemId},
</if>
<if test="itemValue != null" >
item_value=#{itemValue},
</if>
<if test="createTime != null" >
create_time=#{createTime},
</if>
<if test="updateTime != null" >
update_time=#{updateTime},
</if>
<if test="creator != null" >
creator=#{creator},
</if>
<if test="deleteType != null" >
delete_type=#{deleteType},
</if>
<if test="tenantKey != null" >
tenant_key=#{tenantKey},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 根据主键删除记录 -->
<delete id="delete" parameterType="com.engine.salary.entity.datacollection.po.VariableArchiveItemPO">
UPDATE hrsa_variable_archive_item
SET delete_type=1
WHERE id = #{id} AND delete_type = 0
</delete>
<delete id="deleteByIds">
UPDATE hrsa_variable_archive_item
SET delete_type=1
WHERE delete_type = 0
<if test="collection != null and collection.size()>0">
AND id IN
<foreach collection="collection" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
</delete>
<delete id="deleteByArchiveIds">
UPDATE hrsa_variable_archive_item
SET delete_type=1
WHERE delete_type = 0
<if test="collection != null and collection.size()>0">
AND variable_archive_id IN
<foreach collection="collection" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
</delete>
</mapper>

View File

@ -0,0 +1,81 @@
package com.engine.salary.mapper.datacollection;
import com.engine.salary.entity.datacollection.dto.VariableArchiveListDTO;
import com.engine.salary.entity.datacollection.param.VariableArchiveQueryParam;
import com.engine.salary.entity.datacollection.po.VariableArchivePO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author Harryxzy
* @ClassName VariableArchiveMapper
* @date 2024/08/07 9:18
* @description 浮动薪酬档案
*/
public interface VariableArchiveMapper {
/**
* 查询所有记录
*
* @return 返回集合没有返回空List
*/
List<VariableArchivePO> listAll();
/**
* 条件查询
*
* @return 返回集合没有返回空List
*/
List<VariableArchivePO> listSome(VariableArchivePO variableArchive);
/**
* 根据主键查询
*
* @param id 主键
* @return 返回记录没有返回null
*/
VariableArchivePO getById(Long id);
/**
* 新增忽略null字段
*
* @param variableArchive 新增的记录
* @return 返回影响行数
*/
int insertIgnoreNull(VariableArchivePO variableArchive);
/**
* 修改修改所有字段
*
* @param variableArchive 修改的记录
* @return 返回影响行数
*/
int update(VariableArchivePO variableArchive);
/**
* 修改忽略null字段
*
* @param variableArchive 修改的记录
* @return 返回影响行数
*/
int updateIgnoreNull(VariableArchivePO variableArchive);
/**
* 删除记录
*
* @param variableArchive 待删除的记录
* @return 返回影响行数
*/
int delete(VariableArchivePO variableArchive);
/**
* 删除记录
*
* @param variableArchiveIds 待删除的记录id
* @return 返回影响行数
*/
int deleteByIds(@Param("ids")List<Long> variableArchiveIds);
List<VariableArchiveListDTO> list(@Param("param")VariableArchiveQueryParam queryParam);
}

View File

@ -0,0 +1,412 @@
<?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.VariableArchiveMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.datacollection.po.VariableArchivePO">
<result column="id" property="id" />
<result column="employee_id" property="employeeId" />
<result column="salary_month" property="salaryMonth" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<result column="creator" property="creator" />
<result column="delete_type" property="deleteType" />
<result column="tenant_key" property="tenantKey" />
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t.id
, t.employee_id
, t.tax_agent_id
, t.salary_month
, t.create_time
, t.update_time
, t.creator
, t.delete_type
, t.tenant_key
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns" />
FROM hrsa_variable_archive t
WHERE delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns" />
FROM hrsa_variable_archive t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.datacollection.po.VariableArchivePO">
SELECT
<include refid="baseColumns" />
FROM hrsa_variable_archive t
WHERE delete_type = 0
<if test="id != null">
AND id = #{id}
</if>
<if test="employeeId != null">
AND employee_id = #{employeeId}
</if>
<if test="taxAgentId != null">
AND tax_agent_id = #{taxAgentId}
</if>
<if test="salaryMonth != null">
AND salary_month = #{salaryMonth}
</if>
<if test="createTime != null">
AND create_time = #{createTime}
</if>
<if test="updateTime != null">
AND update_time = #{updateTime}
</if>
<if test="creator != null">
AND creator = #{creator}
</if>
<if test="deleteType != null">
AND delete_type = #{deleteType}
</if>
<if test="tenantKey != null">
AND tenant_key = #{tenantKey}
</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>
<sql id="variableArchiveColumn">
t.id
, t.employee_id
, t.tax_agent_id
, t.salary_month
, t.create_time
, t.update_time
, t.creator
, t.delete_type
, e.mobile
, e.workcode
, e.certificatenum as idNo
, e.lastname as username
, e.certificatenum as idNo
, e.companystartdate as companystartdate
, e.enddate as dismissdate
, d.departmentname AS departmentName
, c.subcompanyname AS subcompanyName
, a.name AS taxAgentName
, a.id AS taxAgentId
</sql>
<select id="list" resultType="com.engine.salary.entity.datacollection.dto.VariableArchiveListDTO">
SELECT
<include refid="variableArchiveColumn" />
FROM hrsa_variable_archive t
LEFT JOIN hrmresource e ON e.id = t.employee_id
LEFT JOIN hrmdepartment d ON d.id = e.departmentid
LEFT JOIN hrmsubcompany c ON c.id = e.subcompanyid1
LEFT JOIN hrsa_tax_agent a ON t.tax_agent_id = a.id
WHERE t.delete_type = 0
and e.status not in (7)
and (e.accounttype is null or e.accounttype = 0)
<!-- 个税扣缴义务人 -->
<if test="param.taxAgentIds != null and param.taxAgentIds.size()>0">
AND t.tax_agent_id IN
<foreach collection="param.taxAgentIds" open="(" item="taxAgentId" separator="," close=")">
#{taxAgentId}
</foreach>
</if>
<!-- 薪资所属月 -->
<if test="param.salaryMonth != null">
AND t.salary_month = #{param.salaryMonthDate}
</if>
<if test="param.id != null">
AND t.id = #{param.id}
</if>
<if test="param.ids != null and param.ids.size()>0">
AND t.id IN
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<!-- 姓名 -->
<if test="param.username != null and param.username != ''">
AND e.lastname like CONCAT('%',#{param.username},'%')
</if>
<!-- 工号 -->
<if test="param.workcode != null and param.workcode != ''">
AND e.workcode like CONCAT('%',#{param.workcode},'%')
</if>
<!-- 部门 -->
<if test="param.departmentIds != null and param.departmentIds.size()>0">
AND d.id IN
<foreach collection="param.departmentIds" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<if test="param.employeeIds != null and param.employeeIds.size()>0">
AND t.employee_id IN
<foreach collection="param.employeeIds" open="(" item="empId" separator="," close=")">
#{empId}
</foreach>
</if>
<!-- 排序 -->
<if test="param.orderRule != null">
ORDER BY ${param.orderRule.orderRule} ${param.orderRule.ascOrDesc}
</if>
</select>
<select id="list" resultType="com.engine.salary.entity.datacollection.dto.VariableArchiveListDTO" databaseId="oracle">
SELECT
<include refid="variableArchiveColumn" />
FROM hrsa_variable_archive t
LEFT JOIN hrmresource e ON e.id = t.employee_id
LEFT JOIN hrmdepartment d ON d.id = e.departmentid
LEFT JOIN hrmsubcompany c ON c.id = e.subcompanyid1
LEFT JOIN hrsa_tax_agent a ON t.tax_agent_id = a.id
WHERE t.delete_type = 0
and e.status not in (7)
and (e.accounttype is null or e.accounttype = 0)
<!-- 个税扣缴义务人 -->
<if test="param.taxAgentIds != null and param.taxAgentIds.size()>0">
AND t.tax_agent_id IN
<foreach collection="param.taxAgentIds" open="(" item="taxAgentId" separator="," close=")">
#{taxAgentId}
</foreach>
</if>
<!-- 薪资所属月 -->
<if test="param.salaryMonth != null">
AND t.salary_month = #{param.salaryMonthDate}
</if>
<if test="param.id != null">
AND t.id = #{param.id}
</if>
<if test="param.ids != null and param.ids.size()>0">
AND t.id IN
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<!-- 姓名 -->
<if test="param.username != null and param.username != ''">
AND e.lastname like '%'||#{param.username}||'%'
</if>
<!-- 工号 -->
<if test="param.workcode != null and param.workcode != ''">
AND e.workcode like '%'||#{param.workcode}||'%'
</if>
<!-- 部门 -->
<if test="param.departmentIds != null and param.departmentIds.size()>0">
AND d.id IN
<foreach collection="param.departmentIds" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<if test="param.employeeIds != null and param.employeeIds.size()>0">
AND t.employee_id IN
<foreach collection="param.employeeIds" open="(" item="empId" separator="," close=")">
#{empId}
</foreach>
</if>
<!-- 排序 -->
<if test="param.orderRule != null">
ORDER BY ${param.orderRule.orderRule} ${param.orderRule.ascOrDesc}
</if>
</select>
<select id="list" resultType="com.engine.salary.entity.datacollection.dto.VariableArchiveListDTO" databaseId="sqlserver">
SELECT
<include refid="variableArchiveColumn" />
FROM hrsa_variable_archive t
LEFT JOIN hrmresource e ON e.id = t.employee_id
LEFT JOIN hrmdepartment d ON d.id = e.departmentid
LEFT JOIN hrmsubcompany c ON c.id = e.subcompanyid1
LEFT JOIN hrsa_tax_agent a ON t.tax_agent_id = a.id
WHERE t.delete_type = 0
and e.status not in (7)
and (e.accounttype is null or e.accounttype = 0)
<!-- 个税扣缴义务人 -->
<if test="param.taxAgentIds != null and param.taxAgentIds.size()>0">
AND t.tax_agent_id IN
<foreach collection="param.taxAgentIds" open="(" item="taxAgentId" separator="," close=")">
#{taxAgentId}
</foreach>
</if>
<!-- 薪资所属月 -->
<if test="param.salaryMonth != null">
AND t.salary_month = #{param.salaryMonthDate}
</if>
<if test="param.id != null">
AND t.id = #{param.id}
</if>
<if test="param.ids != null and param.ids.size()>0">
AND t.id IN
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<!-- 姓名 -->
<if test="param.username != null and param.username != ''">
AND e.lastname like '%'+#{param.username}+'%'
</if>
<!-- 工号 -->
<if test="param.workcode != null and param.workcode != ''">
AND e.workcode like '%'+#{workcode}+'%'
</if>
<!-- 部门 -->
<if test="param.departmentIds != null and param.departmentIds.size()>0">
AND d.id IN
<foreach collection="param.departmentIds" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<if test="param.employeeIds != null and param.employeeIds.size()>0">
AND t.employee_id IN
<foreach collection="param.employeeIds" open="(" item="empId" separator="," close=")">
#{empId}
</foreach>
</if>
<!-- 排序 -->
<if test="param.orderRule != null">
ORDER BY ${param.orderRule.orderRule} ${param.orderRule.ascOrDesc}
</if>
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.datacollection.po.VariableArchivePO">
INSERT INTO hrsa_variable_archive
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="taxAgentId != null">
tax_agent_id,
</if>
<if test="employeeId != null">
employee_id,
</if>
<if test="salaryMonth != null">
salary_month,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="tenantKey != null">
tenant_key,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="id != null" >
#{id},
</if>
<if test="taxAgentId != null">
#{taxAgentId},
</if>
<if test="employeeId != null" >
#{employeeId},
</if>
<if test="salaryMonth != null" >
#{salaryMonth},
</if>
<if test="createTime != null" >
#{createTime},
</if>
<if test="updateTime != null" >
#{updateTime},
</if>
<if test="creator != null" >
#{creator},
</if>
<if test="deleteType != null" >
#{deleteType},
</if>
<if test="tenantKey != null" >
#{tenantKey},
</if>
</trim>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.entity.datacollection.po.VariableArchivePO">
UPDATE hrsa_variable_archive
<set>
employee_id=#{employeeId},
salary_month=#{salaryMonth},
create_time=#{createTime},
update_time=#{updateTime},
creator=#{creator},
delete_type=#{deleteType},
tenant_key=#{tenantKey},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.datacollection.po.VariableArchivePO">
UPDATE hrsa_variable_archive
<set>
<if test="employeeId != null" >
employee_id=#{employeeId},
</if>
<if test="salaryMonth != null" >
salary_month=#{salaryMonth},
</if>
<if test="createTime != null" >
create_time=#{createTime},
</if>
<if test="updateTime != null" >
update_time=#{updateTime},
</if>
<if test="creator != null" >
creator=#{creator},
</if>
<if test="deleteType != null" >
delete_type=#{deleteType},
</if>
<if test="tenantKey != null" >
tenant_key=#{tenantKey},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 根据主键删除记录 -->
<update id="delete" parameterType="com.engine.salary.entity.datacollection.po.VariableArchivePO">
UPDATE hrsa_variable_archive
SET delete_type=1
WHERE id = #{id} AND delete_type = 0
</update>
<update id="deleteByIds">
UPDATE hrsa_variable_archive
SET delete_type=1
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>

View File

@ -0,0 +1,68 @@
package com.engine.salary.mapper.datacollection;
import com.engine.salary.entity.datacollection.po.VariableItemPO;
import java.util.List;
/**
* @author Harryxzy
* @ClassName VariableItemMapper
* @date 2024/08/07 9:26
* @description 浮动薪酬项目
*/
public interface VariableItemMapper {
/**
* 查询所有记录
*
* @return 返回集合没有返回空List
*/
List<VariableItemPO> listAll();
/**
* 条件查询
*
* @return 返回集合没有返回空List
*/
List<VariableItemPO> listSome(VariableItemPO variableItem);
/**
* 根据主键查询
*
* @param id 主键
* @return 返回记录没有返回null
*/
VariableItemPO getById(Long id);
/**
* 新增忽略null字段
*
* @param variableItem 新增的记录
* @return 返回影响行数
*/
int insertIgnoreNull(VariableItemPO variableItem);
/**
* 修改修改所有字段
*
* @param variableItem 修改的记录
* @return 返回影响行数
*/
int update(VariableItemPO variableItem);
/**
* 修改忽略null字段
*
* @param variableItem 修改的记录
* @return 返回影响行数
*/
int updateIgnoreNull(VariableItemPO variableItem);
/**
* 删除记录
*
* @param variableItem 待删除的记录
* @return 返回影响行数
*/
int delete(VariableItemPO variableItem);
}

View File

@ -0,0 +1,210 @@
<?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.VariableItemMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.datacollection.po.VariableItemPO">
<result column="id" property="id" />
<result column="name" property="name" />
<result column="code" property="code" />
<result column="data_type" property="dataType" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<result column="creator" property="creator" />
<result column="delete_type" property="deleteType" />
<result column="tenant_key" property="tenantKey" />
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t.id
, t.name
, t.code
, t.data_type
, t.create_time
, t.update_time
, t.creator
, t.delete_type
, t.tenant_key
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns" />
FROM hrsa_variable_item t
WHERE delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns" />
FROM hrsa_variable_item t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.datacollection.po.VariableItemPO">
SELECT
<include refid="baseColumns" />
FROM hrsa_variable_item t
WHERE delete_type = 0
<if test="id != null">
AND id = #{id}
</if>
<if test="name != null">
AND name = #{name}
</if>
<if test="code != null">
AND code = #{code}
</if>
<if test="dataType != null">
AND data_type = #{dataType}
</if>
<if test="createTime != null">
AND create_time = #{createTime}
</if>
<if test="updateTime != null">
AND update_time = #{updateTime}
</if>
<if test="creator != null">
AND creator = #{creator}
</if>
<if test="deleteType != null">
AND delete_type = #{deleteType}
</if>
<if test="tenantKey != null">
AND tenant_key = #{tenantKey}
</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.VariableItemPO">
INSERT INTO hrsa_variable_item
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="name != null">
name,
</if>
<if test="code != null">
code,
</if>
<if test="dataType != null">
data_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="tenantKey != null">
tenant_key,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="id != null" >
#{id},
</if>
<if test="name != null" >
#{name},
</if>
<if test="code != null" >
#{code},
</if>
<if test="dataType != null" >
#{dataType},
</if>
<if test="createTime != null" >
#{createTime},
</if>
<if test="updateTime != null" >
#{updateTime},
</if>
<if test="creator != null" >
#{creator},
</if>
<if test="deleteType != null" >
#{deleteType},
</if>
<if test="tenantKey != null" >
#{tenantKey},
</if>
</trim>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.entity.datacollection.po.VariableItemPO">
UPDATE hrsa_variable_item
<set>
name=#{name},
code=#{code},
data_type=#{dataType},
create_time=#{createTime},
update_time=#{updateTime},
creator=#{creator},
delete_type=#{deleteType},
tenant_key=#{tenantKey},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.datacollection.po.VariableItemPO">
UPDATE hrsa_variable_item
<set>
<if test="name != null" >
name=#{name},
</if>
<if test="code != null" >
code=#{code},
</if>
<if test="dataType != null" >
data_type=#{dataType},
</if>
<if test="createTime != null" >
create_time=#{createTime},
</if>
<if test="updateTime != null" >
update_time=#{updateTime},
</if>
<if test="creator != null" >
creator=#{creator},
</if>
<if test="deleteType != null" >
delete_type=#{deleteType},
</if>
<if test="tenantKey != null" >
tenant_key=#{tenantKey},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 根据主键删除记录 -->
<delete id="delete" parameterType="com.engine.salary.entity.datacollection.po.VariableItemPO">
UPDATE hrsa_variable_item
SET delete_type=1
WHERE id = #{id} AND delete_type = 0
</delete>
</mapper>

View File

@ -409,12 +409,12 @@
update_time, creator, delete_type, tenant_key, data_type, shared_type, tax_agent_ids)
VALUES
<foreach collection="collection" item="item" separator=",">
(#{item_id},#{item_name}, #{item_code}, #{item_systemType}, #{item_sysSalaryItemId},
#{item_useDefault}, #{item_useInEmployeeSalary}, #{item_roundingMode},
#{item_pattern},
#{item_valueType}, #{item_formulaId}, #{item_description}, #{item_canEdit},
#{item_createTime}, #{item_updateTime}, #{item_creator}, 0, #{item_tenantKey}, #{item_dataType},
#{item_sharedType}, #{item_taxAgentIds})
(#{item.id},#{item.name}, #{item.code}, #{item.systemType}, #{item.sysSalaryItemId},
#{item.useDefault}, #{item.useInEmployeeSalary}, #{item.roundingMode},
#{item.pattern},
#{item.valueType}, #{item.formulaId}, #{item.description}, #{item.canEdit},
#{item.createTime}, #{item.updateTime}, #{item.creator}, 0, #{item.tenantKey}, #{item.dataType},
#{item.sharedType}, #{item.taxAgentIds})
</foreach>
</insert>
<insert id="batchInsert" databaseId="oracle">
@ -425,27 +425,27 @@
<foreach collection="collection" item="item" separator="union all">
select
#{item_id,jdbcType=DOUBLE},
#{item_name,jdbcType=VARCHAR},
#{item_code,jdbcType=VARCHAR},
#{item_systemType,jdbcType=INTEGER},
#{item_sysSalaryItemId,jdbcType=DOUBLE},
#{item_useDefault,jdbcType=INTEGER},
#{item_useInEmployeeSalary,jdbcType=INTEGER},
#{item_roundingMode,jdbcType=INTEGER},
#{item_pattern,jdbcType=INTEGER},
#{item_valueType,jdbcType=INTEGER},
#{item_formulaId,jdbcType=DOUBLE},
#{item_description,jdbcType=VARCHAR},
#{item_canEdit,jdbcType=INTEGER},
#{item_createTime,jdbcType=DATE},
#{item_updateTime,jdbcType=DATE},
#{item_creator,jdbcType=DOUBLE},
#{item.id,jdbcType=DOUBLE},
#{item.name,jdbcType=VARCHAR},
#{item.code,jdbcType=VARCHAR},
#{item.systemType,jdbcType=INTEGER},
#{item.sysSalaryItemId,jdbcType=DOUBLE},
#{item.useDefault,jdbcType=INTEGER},
#{item.useInEmployeeSalary,jdbcType=INTEGER},
#{item.roundingMode,jdbcType=INTEGER},
#{item.pattern,jdbcType=INTEGER},
#{item.valueType,jdbcType=INTEGER},
#{item.formulaId,jdbcType=DOUBLE},
#{item.description,jdbcType=VARCHAR},
#{item.canEdit,jdbcType=INTEGER},
#{item.createTime,jdbcType=DATE},
#{item.updateTime,jdbcType=DATE},
#{item.creator,jdbcType=DOUBLE},
0,
#{item_tenantKey,jdbcType=VARCHAR},
#{item_dataType,jdbcType=VARCHAR},
#{item_sharedType,jdbcType=INTEGER},
#{item_taxAgentIds,jdbcType=VARCHAR}
#{item.tenantKey,jdbcType=VARCHAR},
#{item.dataType,jdbcType=VARCHAR},
#{item.sharedType,jdbcType=INTEGER},
#{item.taxAgentIds,jdbcType=VARCHAR}
from dual
</foreach>
</insert>
@ -456,12 +456,12 @@
rounding_mode, pattern, value_type, formula_id, description, can_edit, create_time,
update_time, creator, delete_type, tenant_key, data_type, shared_type, tax_agent_ids)
VALUES
(#{item_id},#{item_name}, #{item_code}, #{item_systemType}, #{item_sysSalaryItemId},
#{item_useDefault}, #{item_useInEmployeeSalary}, #{item_roundingMode},
#{item_pattern},
#{item_valueType}, #{item_formulaId}, #{item_description}, #{item_canEdit},
#{item_createTime}, #{item_updateTime}, #{item_creator}, 0, #{item_tenantKey}, #{item_dataType},
#{item_sharedType}, #{item_taxAgentIds})
(#{item.id},#{item.name}, #{item.code}, #{item.systemType}, #{item.sysSalaryItemId},
#{item.useDefault}, #{item.useInEmployeeSalary}, #{item.roundingMode},
#{item.pattern},
#{item.valueType}, #{item.formulaId}, #{item.description}, #{item.canEdit},
#{item.createTime}, #{item.updateTime}, #{item.creator}, 0, #{item.tenantKey}, #{item.dataType},
#{item.sharedType}, #{item.taxAgentIds})
</foreach>
</insert>
@ -479,8 +479,8 @@
<trim prefix="set" suffixOverrides=",">
<trim prefix="sorted_index =case" suffix="end,">
<foreach collection="collection" item="item" index="index">
<if test="item_sortedIndex!=null">
when id=#{item_id} then #{item_sortedIndex}
<if test="item.sortedIndex!=null">
when id=#{item.id} then #{item.sortedIndex}
</if>
</foreach>
</trim>
@ -488,7 +488,7 @@
where
id in
<foreach collection="collection" item="item" index="index" separator="," open="(" close=")">
#{item_id}
#{item.id}
</foreach>
</update>

View File

@ -26,4 +26,9 @@ public class Attend4Salary {
private List<Long> onlyEmpIds;
private Map<String, Object> extendParam;
/**
* 出勤班次
*/
private String attendanceSerial;
}

View File

@ -4,12 +4,15 @@ import com.alibaba.druid.support.json.JSONUtils;
import com.alibaba.fastjson.JSONObject;
import com.engine.core.impl.Service;
import com.engine.kq.cmd.report.GetKQReportCmd;
import com.engine.salary.mapper.datacollection.AttendQuoteFieldMapper;
import com.engine.salary.remote.attend.cmd.GetSearchListCmd;
import com.engine.salary.remote.attend.entity.Attend4Salary;
import com.engine.salary.remote.attend.service.RemoteAttend4SalaryService;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.valid.ValidUtil;
import com.google.common.base.Joiner;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
@ -26,15 +29,22 @@ import java.util.stream.Collectors;
public class RemoteAttend4SalaryServiceImpl extends Service implements RemoteAttend4SalaryService {
private final Boolean isLog = "true".equals(new BaseBean().getPropValue("hrmSalary", "log"));
private AttendQuoteFieldMapper getAttendQuoteFieldMapper() {
return MapperProxyFactory.getProxy(AttendQuoteFieldMapper.class);
}
@Override
public List<Map<String, String>> getColumns() {
//兼容获取班次信息字段
List<String> attendanceSerials = getAttendQuoteFieldMapper().getAttendanceSerials();
String attendanceSerial = Joiner.on(",").join((Iterable<?>) attendanceSerials);
Map<String, Object> paramsMap = new HashMap<String, Object>();
// paramsMap.put("pageIndex", 1);
// paramsMap.put("pageSize", 10);
paramsMap.put("typeselect", "3");
paramsMap.put("viewScope", "0");
paramsMap.put("isNoAccount", "1");
paramsMap.put("attendanceSerial", "");
paramsMap.put("attendanceSerial", attendanceSerial);
paramsMap.put("isFromMyAttendance", "1");
Map<String, Object> temp = new HashMap<String, Object>();
temp.put("data", JSONObject.toJSONString(paramsMap));
@ -60,6 +70,21 @@ public class RemoteAttend4SalaryServiceImpl extends Service implements RemoteAtt
});
}
}
//出勤班次
else if (dataIndex.equals("attendanceSerial") && column.get("children") != null) {
List<Map> list = (List<Map>) column.get("children");
if (CollectionUtils.isNotEmpty(list)) {
list.stream()
.filter(leave -> leave.get("dataIndex") != null && StringUtils.isNotBlank(leave.get("dataIndex").toString()))
.forEach(leave -> {
Map<String, String> map = Maps.newHashMapWithExpectedSize(2);
map.put("code", "attendanceSerial_" + leave.get("dataIndex").toString());
String unit = "".equals(leave.get("unit").toString()) ? "" : "(" + leave.get("unit").toString() + ")";
map.put("name", Util.null2String(column.get("title")) + "-" + leave.get("title") + unit);
columns.add(map);
});
}
}
//加班
else if (dataIndex.equals("overtime") && column.get("children") != null) {
List<Map> list = (List<Map>) column.get("children");
@ -121,7 +146,8 @@ public class RemoteAttend4SalaryServiceImpl extends Service implements RemoteAtt
List<String> resourceIds = attend4Salary.getOnlyEmpIds().stream().map(String::valueOf).collect(Collectors.toList());
paramsMap.put("resourceId", String.join(",", resourceIds));
paramsMap.put("isNoAccount", "1");
paramsMap.put("attendanceSerial", "");
//班次
paramsMap.put("attendanceSerial", attend4Salary.getAttendanceSerial());
paramsMap.put("isFromMyAttendance", "1");
Map<String, Object> temp = new HashMap<String, Object>();
temp.put("data", JSONObject.toJSONString(paramsMap));

View File

@ -129,7 +129,9 @@ public class SalaryStatisticsReportBO {
param.setDepart(((List<Map>) JSON.parseArray(po.getDepartSetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList()));
}
// param.setGrade(((List<Map>) JSON.parseArray(po.getGradeSetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList()));
// param.setPosition(((List<Map>) JSON.parseArray(po.getPositionSetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList()));
if (po.getPositionSetting() != null) {
param.setPosition(((List<Map>) JSON.parseArray(po.getPositionSetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList()));
}
if (po.getStatusSetting() != null) {
param.setStatus(((List<Map>) JSON.parseArray(po.getStatusSetting(), Map.class)).stream().map(m -> m.get(key).toString()).collect(Collectors.toList()));
}

View File

@ -445,8 +445,18 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
// 获取报表统计薪资项目
List<Long> salaryItemIds = salaryStatisticsItemPOS.stream().filter(item -> StringUtils.isNotBlank(item.getItemValue())).map(p -> p.getItemValue().split(",")).flatMap(Arrays::stream).map(Long::valueOf).collect(Collectors.toList());
// 参数转换
param.setSalaryStartMonth(SalaryDateUtil.getFormatYearMonth(reportPO.getSalaryStartMonth()));
param.setSalaryEndMonth(SalaryDateUtil.getFormatYearMonth(reportPO.getSalaryEndMonth()));
String salaryStartMonth = param.getSalaryStartMonth();
if (salaryStartMonth == null) {
param.setSalaryStartMonth(SalaryDateUtil.getFormatYearMonth(reportPO.getSalaryStartMonth()));
} else {
param.setSalaryStartMonth(SalaryDateUtil.getFormatYearMonth(SalaryDateUtil.dateStrToLocalDate(salaryStartMonth)));
}
String salaryEndMonth = param.getSalaryEndMonth();
if (salaryEndMonth == null) {
param.setSalaryEndMonth(SalaryDateUtil.getFormatYearMonth(reportPO.getSalaryEndMonth()));
} else {
param.setSalaryEndMonth(SalaryDateUtil.getFormatYearMonth(SalaryDateUtil.dateStrToLocalDate(salaryEndMonth)));
}
String key = "id";
if (reportPO.getTaxAgentSetting() != null) {
param.setTaxAgent(((List<Map>) JSON.parseArray(reportPO.getTaxAgentSetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList()));
@ -606,7 +616,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
DataCollectionEmployee emp = employeeMap.get(se.getEmployeeId());
resultMap.put("id", se.getId().toString());
resultMap.put("userName", emp == null ? "" : emp.getUsername());
resultMap.put("departmentName", emp == null ? "" : emp.getDepartmentName());
resultMap.put("departmentName", se.getDepartmentName());
resultMap.put("salaryMonth", SalaryDateUtil.getFormatYearMonth(se.getSalaryMonth()));
resultMap.put("taxAgent", taxAgentMap.get(se.getTaxAgentId()));
resultMap.put("salarySob", SalarySobMap.get(se.getSalarySobId()));

View File

@ -134,17 +134,4 @@ public class SalaryStatisticsEmployeeController {
throw e;
}
}
// /**
// * 导出员工详情列表
// *
// * @param queryParam
// * @return
// */
// @PostMapping("/exportDetailList")
// @ApiOperation("导出员工详情列表")
// @WeaPermission(publicPermission = true)
// public WeaResult<Map<String, Object>> exportDetailList(@RequestBody SalaryStatisticsEmployeeDetailQueryParam queryParam) {
// return WeaResult.success(getSalaryStatisticsEmployeeWrapper(user).exportDetailList(queryParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()));
// }
}

View File

@ -0,0 +1,35 @@
package com.engine.salary.service;
import com.engine.salary.entity.datacollection.po.VariableArchiveItemPO;
import java.util.List;
/**
* @author Harryxzy
* @ClassName VariableArchiveItemService
* @date 2024/08/07 9:29
* @description 浮动薪资档案明细值
*/
public interface VariableArchiveItemService {
/**
* 根据浮动薪资档案id获取
*
* @param variableArchiveIds
* @return
*/
List<VariableArchiveItemPO> listByVariableArchiveIds(List<Long> variableArchiveIds);
/**
* 查询浮动薪酬档案中已使用的浮动薪资项目
*
* @return
*/
List<Long> listUsingItems();
int batchInsert(List<VariableArchiveItemPO> variableArchiveItemList);
void deleteByIds(List<Long> variableArchiveItemIds);
void deleteByArchiveIds(List<Long> variableArchiveIds);
}

View File

@ -0,0 +1,73 @@
package com.engine.salary.service;
import com.engine.salary.entity.datacollection.dto.VariableArchiveListDTO;
import com.engine.salary.entity.datacollection.dto.VariableItemListDTO;
import com.engine.salary.entity.datacollection.param.VariableArchiveImportHandleParam;
import com.engine.salary.entity.datacollection.param.VariableArchiveQueryParam;
import com.engine.salary.entity.datacollection.param.VariableArchiveSaveParam;
import com.engine.salary.util.excel.ExcelPreviewDTO;
import com.engine.salary.util.page.PageInfo;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.time.YearMonth;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* 数据采集-浮动薪酬
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author xzy
* @version 1.0
**/
public interface VariableArchiveService {
/**
* 查询浮动薪酬档案分页
*
* @param queryParam
* @return
*/
PageInfo<VariableArchiveListDTO> listPage(VariableArchiveQueryParam queryParam);
List<VariableArchiveListDTO> list(VariableArchiveQueryParam queryParam);
/**
* 构建浮动薪资档案数据
*
* @param variableArchives
* @return
*/
List<Map<String, Object>> buildVariableArchiveData(Collection<VariableArchiveListDTO> variableArchives);
/**
* 创建浮动薪酬档案
*
* @param saveParam
*/
void createData(VariableArchiveSaveParam saveParam);
/**
* 浮动薪资档案明细
*
* @param queryParam
* @return
*/
Map<String, Object> getDetail(VariableArchiveQueryParam queryParam);
List<VariableItemListDTO> getCreateForm();
XSSFWorkbook downloadTemplate(VariableArchiveQueryParam param);
ExcelPreviewDTO preview(VariableArchiveImportHandleParam importParam);
Map<String, Object> importData(VariableArchiveImportHandleParam importParam);
XSSFWorkbook export(VariableArchiveQueryParam param);
void deleteSelectVariableArchive(Collection<Long> deleteIds);
List<Map<String, Object>> listBySalaryMonthAndEmployeeIds(YearMonth salaryMonth, List<Long> employeeIds, Long taxAgentId);
}

View File

@ -0,0 +1,66 @@
package com.engine.salary.service;
import com.engine.salary.entity.datacollection.dto.VariableItemListDTO;
import com.engine.salary.entity.datacollection.param.VariableItemQueryParam;
import com.engine.salary.entity.datacollection.param.VariableItemSaveParam;
import com.engine.salary.entity.datacollection.po.VariableItemPO;
import com.engine.salary.util.page.PageInfo;
import java.util.List;
/**
* @author Harryxzy
* @ClassName VariableItemService
* @date 2024/08/07 9:30
* @description 浮动薪酬项目
*/
public interface VariableItemService {
VariableItemPO getById(Long id);
List<VariableItemPO> listByIds(List<Long> ids);
/**
* 获取所有的浮动薪酬项目
*
* @return
*/
List<VariableItemPO> listAll();
/**
* 获取浮动薪资项目列表分页
*
* @param queryParam
* @return
*/
PageInfo<VariableItemListDTO> listPage(VariableItemQueryParam queryParam);
/**
* 新建浮动薪酬项目
*
* @param saveParam
*/
Integer save(VariableItemSaveParam saveParam);
/**
* 更新浮动薪酬项目
*
* @param saveParam
*/
VariableItemPO update(VariableItemSaveParam saveParam);
/**
* 删除浮动薪资项目
*
* @param itemIds
*/
void deleteItems(List<Long> itemIds);
/**
* 浮动薪酬项目详细信息
*
* @param id
* @return
*/
VariableItemListDTO getDetail(Long id);
}

View File

@ -278,9 +278,10 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
AddUpSituationBiz biz = new AddUpSituationBiz();
List<AddUpSituation> addUpSituations = biz.listSome(AddUpSituation.builder().taxAgentId(taxAgentId).taxYearMonth(taxCycle).build());
Set<Long> addUpSituationIds = SalaryEntityUtil.properties(addUpSituations, AddUpSituation::getId);
List<Long> addUpSituationIds = SalaryEntityUtil.properties(addUpSituations, AddUpSituation::getId, Collectors.toList());
if (CollectionUtils.isNotEmpty(addUpSituationIds)) {
getAddUpSituationMapper().deleteByIds(addUpSituationIds);
List<List<Long>> partition = Lists.partition(addUpSituationIds, 100);
partition.forEach(getAddUpSituationMapper()::deleteByIds);
}
return Boolean.TRUE;

View File

@ -70,6 +70,7 @@ import org.apache.poi.util.IOUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.file.ImageFileManager;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.wechat.util.Utils;
@ -131,7 +132,6 @@ public class AttendQuoteDataServiceImpl extends Service implements AttendQuoteDa
}
private RemoteAttend4SalaryService getRemoteAttend4SalaryService(User user) {
return ServiceUtil.getService(RemoteAttend4SalaryServiceImpl.class, user);
}
@ -250,6 +250,16 @@ public class AttendQuoteDataServiceImpl extends Service implements AttendQuoteDa
// 获取最终结果
List<Map<String, Object>> listMaps = getListMaps(attendQuoteDataBases);
//当前引用的值
List<String> effectiveColumns = listMaps.stream()
.map(Map::keySet)
.max(Comparator.comparingInt(Set::size))
.orElse(new HashSet<>())
.stream()
.map(key -> key.split("_")[0])
.collect(Collectors.toList());
// 1.工作簿名称
String sheetName = SalaryI18nUtil.getI18nLabel(93931, "考勤数据");
List<Object> header = new ArrayList<>();
@ -258,10 +268,16 @@ public class AttendQuoteDataServiceImpl extends Service implements AttendQuoteDa
header.add(SalaryI18nUtil.getI18nLabel(86186, "手机号"));
header.add(SalaryI18nUtil.getI18nLabel(86317, "工号"));
// 动态列
List<AttendQuoteFieldPO> effectiveFields = new ArrayList<>();
if (CollectionUtils.isNotEmpty(listMaps)) {
for (AttendQuoteFieldPO attendQuoteField : attendQuoteFields) {
header.add(attendQuoteField.getFieldName());
}
effectiveFields = attendQuoteFields.stream()
.filter(attendQuoteField -> effectiveColumns.contains(Util.null2String(attendQuoteField.getId())))
.collect(Collectors.toList());
effectiveFields.forEach(attendQuoteField -> {
header.add(attendQuoteField.getFieldName());
}
);
}
List<List<Object>> rows = new ArrayList<>();
@ -276,7 +292,7 @@ public class AttendQuoteDataServiceImpl extends Service implements AttendQuoteDa
row.add(dto.get("jobNum"));
// 动态列
for (AttendQuoteFieldPO attendQuoteField : attendQuoteFields) {
for (AttendQuoteFieldPO attendQuoteField : effectiveFields) {
Object o = dto.get(attendQuoteField.getId().toString() + "_attendQuoteData");
try {
if (o != null && NumberUtil.isNumber(o.toString())) {
@ -509,13 +525,17 @@ public class AttendQuoteDataServiceImpl extends Service implements AttendQuoteDa
attend4Salary.setBeginDate(attendCycleRange.getFromDate());
attend4Salary.setEndDate(attendCycleRange.getEndDate());
attend4Salary.setOnlyEmpIds(part);
//班次信息
String attendanceSerial = attendQuoteFields.stream()
.filter(f -> f.getCode() != null && f.getCode().startsWith("attendanceSerial_"))
.map(f -> f.getCode().replace("attendanceSerial_", ""))
.collect(Collectors.joining(","));
attend4Salary.setAttendanceSerial(attendanceSerial);
List<Map<String, String>> attendResult = getRemoteAttend4SalaryService(user).getDatas(attend4Salary);
AttendQuoteDataBO.buildAttendDataFromRemote(attendResult, attendQuoteFields, attendQuoteSyncData);
// attend4Salary.setUnit("day");
// attendResult = remoteAttend4SalaryService.getWorkTimeSummary(attend4Salary);
// log.info("考勤数据[按天]:{}", JSONUtils.toJSONString(attendResult.getData()));
// AttendQuoteDataBO.buildAttendDataFromRemote("day", attendResult.getData(), attendQuoteFields, attendQuoteSyncData);
}
} catch (Exception e) {
log.error("salaryAttend获取考勤数据错误失败:{}", String.format("参数:%s,错误信息:%s", JSONObject.toJSONString(attend4Salary), e.getMessage()), e);
@ -663,7 +683,7 @@ public class AttendQuoteDataServiceImpl extends Service implements AttendQuoteDa
String confValue = (salarySysConfPO != null && salarySysConfPO.getConfValue() != null && !"".equals(salarySysConfPO.getConfValue())) ? salarySysConfPO.getConfValue() : "0";
// 获取租户下所有的人员
List<DataCollectionEmployee> employees = getSalaryEmployeeService(user).listAll(UseEmployeeTypeEnum.ALL);
List<DataCollectionEmployee> employees = getSalaryEmployeeService(user).listAll(UseEmployeeTypeEnum.ALL);
// 获取已设置的可同步的考勤字段
List<AttendQuoteFieldPO> attendQuoteFields = getAttendQuoteSetFields(AttendQuoteSourceTypeEnum.IMPORT);
// 生成获取考勤引用

View File

@ -9,9 +9,11 @@ import com.engine.salary.enums.salaryformula.ReferenceTypeEnum;
import com.engine.salary.formlua.core.QlExpress;
import com.engine.salary.formlua.entity.parameter.DataType;
import com.engine.salary.formlua.entity.standard.ExcelResult;
import com.engine.salary.mapper.SQLMapper;
import com.engine.salary.service.FormulaRunService;
import com.engine.salary.sys.enums.OpenEnum;
import com.engine.salary.util.JsonUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.ql.util.express.DefaultContext;
import com.ql.util.express.ExpressRunner;
import lombok.extern.slf4j.Slf4j;
@ -41,6 +43,9 @@ public class FormulaRunServiceImpl extends Service implements FormulaRunService
QlExpress express = new QlExpress();
private SQLMapper getSQLMapper(){
return MapperProxyFactory.getProxy(SQLMapper.class);
}
@Override
public ExcelResult run(ExpressFormula expressFormula, List<FormulaVar> formulaVars, DataCollectionEmployee simpleEmployee) {
@ -123,6 +128,12 @@ public class FormulaRunServiceImpl extends Service implements FormulaRunService
}
}
} else {
// List<Map> list = getSQLMapper().runSQL(sql);
// if(CollectionUtil.isNotEmpty(list)){
// result = Util.null2String(list.get(0).get(sqlReturnKey));
// }
RecordSet rs = new RecordSet();
if (rs.execute(sql)) {
if (rs.next()) {

View File

@ -10,6 +10,7 @@ import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.datacollection.dto.AttendQuoteFieldListDTO;
import com.engine.salary.entity.datacollection.param.AttendQuoteFieldQueryParam;
import com.engine.salary.entity.datacollection.po.OtherDeductionPO;
import com.engine.salary.entity.datacollection.po.VariableItemPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
import com.engine.salary.entity.salaryformula.dto.SalaryFormulaTaxRateDTO;
import com.engine.salary.entity.salaryformula.po.FormulaVar;
@ -77,6 +78,10 @@ public class RemoteExcelServiceImpl extends Service implements RemoteExcelServic
return (SalarySobItemService) ServiceUtil.getService(SalarySobItemServiceImpl.class, user);
}
private VariableItemService getVariableItemService(User user) {
return ServiceUtil.getService(VariableItemServiceImpl.class, user);
}
// @Override
// public ExcelResult aggregation(AggFunc func, String sourceId, String fieldId, List<FormulaFilterData> filterFormDataList, Map<String, Object> extendParam,
// DataCollectionEmployee employee) {
@ -166,6 +171,9 @@ public class RemoteExcelServiceImpl extends Service implements RemoteExcelServic
case SALARY_CYCLE:
vars = convert2FormulaVar(SalarySobCycleDTO.class, referenceEnum.getValue() + "");
break;
case VARIABLE_ITEM:
vars = variableArchives2FormulaVar(referenceEnum, extendParam);
break;
default:
break;
}
@ -251,6 +259,8 @@ public class RemoteExcelServiceImpl extends Service implements RemoteExcelServic
convert2FormulaVar(SalaryAcctEmployeePO.class, SalarySQLReferenceEnum.SALARY_ACCT_EMPLOYEE.getValue() + ""));
result.put(SalarySQLReferenceEnum.SALARY_CYCLE.getDefaultLabel(),
convert2FormulaVar(SalarySobCycleDTO.class, SalarySQLReferenceEnum.SALARY_CYCLE.getValue() + ""));
result.put(SalaryFormulaReferenceEnum.VARIABLE_ITEM.getDefaultLabel(),
variableArchives2FormulaVar(SalaryFormulaReferenceEnum.VARIABLE_ITEM, null));
return result;
}
return result;
@ -402,6 +412,20 @@ public class RemoteExcelServiceImpl extends Service implements RemoteExcelServic
}).collect(Collectors.toList());
}
private List<FormulaVar> variableArchives2FormulaVar(SalaryFormulaReferenceEnum referenceEnum, Map<String, Object> extendParam) {
List<VariableItemPO> variableItems;
variableItems = getVariableItemService(user).listAll();
return variableItems.stream()
.map(e -> {
FormulaVar formulaVar = new FormulaVar();
formulaVar.setFieldId(referenceEnum.getValue() + SalaryFormulaFieldConstant.FIELD_ID_SEPARATOR + e.getCode());
formulaVar.setName(e.getName());
formulaVar.setSource("" + referenceEnum.getValue());
formulaVar.setFieldType(e.getDataType());
return formulaVar;
}).collect(Collectors.toList());
}
private <T> List<FormulaVar> convert2FormulaVar(Class<T> clazz, String formId) {
Field[] declaredFields = clazz.getDeclaredFields();
List<FormulaVar> formulaVars = Lists.newArrayListWithExpectedSize(declaredFields.length);

View File

@ -172,7 +172,9 @@ public class SIBalanceServiceImpl extends Service implements SIBalanceService {
Map<String, String> socialComMap = JSON.parseObject(socialSchemePO.getSocialPaymentComBaseString(), new HashMap<String, String>().getClass());
List<String> socialIds = new ArrayList<>();
socialIds.addAll(socialMap.keySet());
socialIds.addAll(socialComMap.keySet());
if (socialComMap != null) {
socialIds.addAll(socialComMap.keySet());
}
socialIds = socialIds.stream().distinct().collect(Collectors.toList());
//查询该福利方案下开启缴纳的福利项
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(socialSchemePO.getSocialSchemeId());
@ -213,7 +215,9 @@ public class SIBalanceServiceImpl extends Service implements SIBalanceService {
Map<String, String> fundComMap = JSON.parseObject(fundSchemePO.getFundPaymentComBaseString(), new HashMap<String, String>().getClass());
List<String> fundIds = new ArrayList<>();
fundIds.addAll(fundMap.keySet());
fundIds.addAll(fundComMap.keySet());
if (fundComMap != null) {
fundIds.addAll(fundComMap.keySet());
}
fundIds = fundIds.stream().distinct().collect(Collectors.toList());
//查询该福利方案下开启缴纳的福利项
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(fundSchemePO.getFundSchemeId());
@ -254,7 +258,9 @@ public class SIBalanceServiceImpl extends Service implements SIBalanceService {
Map<String, String> otherComMap = JSON.parseObject(otherSchemePO.getOtherPaymentComBaseString(), new HashMap<String, String>().getClass());
List<String> otherIds = new ArrayList<>();
otherIds.addAll(otherMap.keySet());
otherIds.addAll(otherComMap.keySet());
if (otherComMap != null) {
otherIds.addAll(otherComMap.keySet());
}
otherIds = otherIds.stream().distinct().collect(Collectors.toList());
//查询该福利方案下开启缴纳的福利项
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(otherSchemePO.getOtherSchemeId());

View File

@ -110,8 +110,13 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
return ServiceUtil.getService(SalaryAcctEmployeeServiceImpl.class, user);
}
private VariableArchiveService getVariableArchiveService(User user) {
return ServiceUtil.getService(VariableArchiveServiceImpl.class, user);
}
@Override
public void calculate(SalaryAcctCalculateBO salaryAcctCalculateBO, DataCollectionEmployee simpleEmployee, List<SalarySobBackItemPO> salarySobBackItems) {
log.info("开始核算V3 {}", salaryAcctCalculateBO);
StopWatch sw = new StopWatch("核算耗时明细id" + salaryAcctCalculateBO.getSalaryAcctRecordPO().getId() + "");
Date now = new Date();
try {
@ -158,6 +163,10 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
List<Long> salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctCalculateBO.getSalaryAcctEmployeePOS(), SalaryAcctEmployeePO::getId, Collectors.toList());
List<SalaryAcctResultPO> salaryAcctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds);
sw.stop();
// 查询浮动薪资
sw.start("查询浮动薪资");
List<Map<String, Object>> variableArchiveList = getVariableArchiveService(user).listBySalaryMonthAndEmployeeIds(salarySobCycleDTO.getSalaryMonth(), employeeIds, taxAgentId);
sw.stop();
// 薪资回算时回算前的核算结果 (没有回算项)
sw.start("查询薪资回算时回算前的核算结果");
Map<String, List<SalaryAcctResultPO>> collect = salaryAcctResultPOS.stream().collect(Collectors.groupingBy(k -> k.getEmployeeId() + "-" + k.getTaxAgentId() + "-" + k.getSalaryItemId()));
@ -181,7 +190,7 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
sw.stop();
// 10转换成公式编辑器中的变量
sw.start("转换成公式编辑器中的变量");
CalculateFormulaVarBO calculateFormulaVarBO = new CalculateFormulaVarBO(simpleEmployees, salaryArchiveData, addUpSituationPOS, addUpDeductionPOS, otherDeductionPOS, welfareData, attendQuoteDataDTOS, salaryAcctResultPOS);
CalculateFormulaVarBO calculateFormulaVarBO = new CalculateFormulaVarBO(simpleEmployees, salaryArchiveData, addUpSituationPOS, addUpDeductionPOS, otherDeductionPOS, welfareData, attendQuoteDataDTOS, salaryAcctResultPOS, variableArchiveList);
Map<String, List<CalculateFormulaVarBO.FormulaVarValue>> formulaVarMap = calculateFormulaVarBO.convert2FormulaVar(salaryAcctCalculateBO);
sw.stop();
sw.start("数据结构准备");

View File

@ -450,6 +450,11 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
@Override
public void deleteByIds(Collection<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return;
}
// 删除薪资核算人员
getSalaryAcctEmployeeMapper().deleteByIds(ids);
// 删除薪资核算人员对应的薪资核算结果
@ -553,36 +558,47 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
@Override
public void refresh(Long salaryAcctRecordId) {
// 查询薪资核算人员
List<SalaryAcctEmployeePO> salaryAcctEmployeePOS = listBySalaryAcctRecordId(salaryAcctRecordId);
if (CollectionUtils.isEmpty(salaryAcctEmployeePOS)) {
return;
}
List<Long> employeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getEmployeeId, Collectors.toList());
// 查询薪资核算记录
SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(salaryAcctRecordId);
if (Objects.isNull(salaryAcctRecordPO)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98747, "薪资核算记录不存在或已被删除"));
}
// 根据薪资账套查询人员
List<DataCollectionEmployee> salaryEmployees = getSalaryEmployeeService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
if (CollectionUtils.isEmpty(salaryEmployees)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98747, "未查询到账套下关联人员"));
}
// 根据薪资账套查询薪资周期
SalarySobCycleDTO salarySobCycleDTO = getSalarySobService(user).getSalarySobCycle(salaryAcctRecordPO.getSalarySobId(), SalaryDateUtil.localDate2YearMonth(salaryAcctRecordPO.getSalaryMonth()));
//查询账套对应的扣缴义务人
SalarySobPO salarySobPO = getSalarySobService(user).getById(salaryAcctRecordPO.getSalarySobId());
//过滤掉不属于当前账套扣缴义务人的人员
Long taxAgentId = salarySobPO.getTaxAgentId();
// 查询薪资核算记录所用的帐套的薪资周期
SalarySobCycleDTO salarySobCycleDTO = getSalarySobService(user).getSalarySobCycle(salaryAcctRecordPO.getSalarySobId(), SalaryDateUtil.localDate2YearMonth(salaryAcctRecordPO.getSalaryMonth()));
// 查询薪资档案获取人员的个税扣缴义务人
List<Long> employeeIds = SalaryEntityUtil.properties(salaryEmployees, DataCollectionEmployee::getEmployeeId, Collectors.toList());
List<SalaryArchiveDataDTO> salaryArchiveDataDTOS = getSalaryArchiveService(user).getSalaryArchiveTaxAgentData(salarySobCycleDTO.getSalaryCycle(), employeeIds, taxAgentId);
List<DataCollectionEmployee> employees = getSalaryEmployeeService(user).getEmployeeByIdsAll(employeeIds);
// 转换成薪资核算人员po
List<SalaryAcctEmployeePO> newSalaryAcctEmployeePOS = SalaryAcctEmployeeBO.convert2Employee(employees, salaryAcctRecordPO, salaryArchiveDataDTOS, (long) user.getUID());
newSalaryAcctEmployeePOS = newSalaryAcctEmployeePOS.stream().filter(po -> Objects.equals(taxAgentId, po.getTaxAgentId())).collect(Collectors.toList());
// 删除以前的薪资核算人员
getSalaryAcctEmployeeMapper().deleteBySalaryAcctRecordIds(Collections.singleton(salaryAcctRecordId));
// 插入新的薪资核算人员
if (CollectionUtils.isNotEmpty(newSalaryAcctEmployeePOS)) {
batchSave(newSalaryAcctEmployeePOS);
}
List<SalaryAcctEmployeePO> newEmps = SalaryAcctEmployeeBO.convert2Employee(salaryEmployees, salaryAcctRecordPO, salaryArchiveDataDTOS, (long) user.getUID());
//过滤掉不属于当前账套扣缴义务人的人员
newEmps = newEmps.stream().filter(po -> Objects.equals(taxAgentId, po.getTaxAgentId())).collect(Collectors.toList());
Map<String, SalaryAcctEmployeePO> newEmpMap = SalaryEntityUtil.convert2Map(newEmps, e -> e.getTaxAgentId() + "_" + e.getEmployeeId());
// 查询薪资核算人员
List<SalaryAcctEmployeePO> oldEmps = listBySalaryAcctRecordId(salaryAcctRecordId);
Map<String, SalaryAcctEmployeePO> oldEmpMap = SalaryEntityUtil.convert2Map(oldEmps, e -> e.getTaxAgentId() + "_" + e.getEmployeeId());
//新增
List<SalaryAcctEmployeePO> addEmps = newEmps.stream().filter(po -> !oldEmpMap.containsKey(po.getTaxAgentId() + "_" + po.getEmployeeId())).collect(Collectors.toList());
//删除
List<Long> delIds = oldEmps.stream().filter(po -> !newEmpMap.containsKey(po.getTaxAgentId() + "_" + po.getEmployeeId())).map(SalaryAcctEmployeePO::getId).collect(Collectors.toList());
deleteByIds(delIds);
batchSave(addEmps);
}
@ -718,19 +734,20 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
// }
// list = list.stream().filter(po -> employeeIdsByGradeFilter.contains(po.getEmployeeId())).collect(Collectors.toList());
// }
// // 岗位过滤
// if (CollectionUtils.isNotEmpty(param.getPosition())) {
// Set<Long> employeeIdsByPostionFilter = new HashSet<>();
// simpleEmployeeList.forEach(simpleEmployee -> {
// if (simpleEmployee.getPosition() != null && param.getPosition().contains(simpleEmployee.getPosition().getId())) {
// employeeIdsByPostionFilter.add(simpleEmployee.getEmployeeId());
// }
// });
// if (CollectionUtils.isEmpty(employeeIdsByPostionFilter)) {
// return Lists.newArrayList();
// }
// list = list.stream().filter(po -> employeeIdsByPostionFilter.contains(po.getEmployeeId())).collect(Collectors.toList());
// }
// 岗位过滤
List<Long> position = param.getPosition();
if (CollectionUtils.isNotEmpty(position)) {
// Set<Long> employeeIdsByPostionFilter = new HashSet<>();
// simpleEmployeeList.forEach(simpleEmployee -> {
// if (simpleEmployee.getPosition() != null && param.getPosition().contains(simpleEmployee.getPosition().getId())) {
// employeeIdsByPostionFilter.add(simpleEmployee.getEmployeeId());
// }
// });
// if (CollectionUtils.isEmpty(employeeIdsByPostionFilter)) {
// return Lists.newArrayList();
// }
employeeList = employeeList.stream().filter(emp -> position.contains(emp.getJobtitleId())).collect(Collectors.toList());
}
// 人事状态过滤
if (CollectionUtils.isNotEmpty(param.getStatus())) {
Set<Long> employeeIdsByStatus = new HashSet<>();

View File

@ -11,6 +11,7 @@ import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.datacollection.dto.AttendQuoteFieldListDTO;
import com.engine.salary.entity.datacollection.po.VariableItemPO;
import com.engine.salary.entity.hrm.DeptInfo;
import com.engine.salary.entity.hrm.JobCallInfo;
import com.engine.salary.entity.hrm.PositionInfo;
@ -201,6 +202,10 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
return ServiceUtil.getService(TaxAgentAdminServiceImpl.class, user);
}
private VariableItemService getVariableItemService(User user) {
return ServiceUtil.getService(VariableItemServiceImpl.class, user);
}
private SalaryCheckResultService salaryCheckResultService;
private SalaryAcctSobConfigService getSalaryAcctSobConfigService(User user) {
@ -785,8 +790,9 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
@Override
public void calculate(SalaryAcctCalculateParam calculateParam, DataCollectionEmployee simpleEmployee) {
StopWatch stopWatch = new StopWatch("总核算耗时id" + calculateParam.getSalaryAcctRecordId());
try {
log.info("开始核算V2 {}", calculateParam);
StopWatch stopWatch = new StopWatch("总核算耗时id" + calculateParam.getSalaryAcctRecordId());
stopWatch.start("数据准备");
// 1查询薪资核算记录
SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(calculateParam.getSalaryAcctRecordId());
@ -826,6 +832,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
Map<String, String> welfareColumns = getSIAccountService(user).welfareColumns();
// 7查询考勤引用的所有字段
List<AttendQuoteFieldListDTO> attendQuoteFieldListDTOS = getAttendQuoteFieldService(user).listAll();
List<VariableItemPO> variableItemPOS = getVariableItemService(user).listAll();
// 8查询公式详情
Set<Long> formulaIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getFormulaId);
@ -875,8 +882,8 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
getSalaryAcctProgressService(user).initProgress(SalaryCacheKey.ACCT_PROGRESS + calculateParam.getSalaryAcctRecordId(), initProgress);
// 12对薪资核算人员进行拆分
String personNumberInOneThread = new BaseBean().getPropValue("hrmSalaryCustom", "personNumberInOneThread");
int size= 100;
if(StringUtils.isNotBlank(personNumberInOneThread)){
int size = 100;
if (StringUtils.isNotBlank(personNumberInOneThread)) {
size = Integer.parseInt(personNumberInOneThread);
}
List<List<SalaryAcctEmployeePO>> partition = Lists.partition(salaryAcctEmployeePOS, size);
@ -909,6 +916,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
.setChildMonitor(childMonitor)
.setResults(calculateResults)
.setCalculateKey(calculateKey)
.setVariableItems(variableItemPOS)
.setTaxDeclarationFunction(taxDeclarationFunction)
.setTaxIds(taxIds);
List<SalarySobBackItemPO> finalSalarySobBackItems = salarySobBackItems;
@ -1217,13 +1225,6 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
List<SalaryAcctResultPO> salaryAcctResultPOS = SalaryAcctResultBO.convert2ResultPO(salaryAcctResultTempPOS);
batchSave(salaryAcctResultPOS);
sw.stop();
new Thread() {
public void run() {
//保存核算报表数据
List<SalaryAcctResultReportPO> salaryAcctResultReportPOS = SalaryAcctResultReportBO.convert2ReportPO(salaryAcctResultTempPOS, calculateParam.getEmps());
getSalaryAcctReportService(user).batchSave(salaryAcctResultReportPOS);
}
}.start();
// 删除薪资核算临时存储表中的数据
sw.start("处理核算数据,删除薪资核算临时存储表中的数据");
getSalaryAcctResultTempService(user).deleteByCalculateKey(calculateKey);

View File

@ -54,6 +54,7 @@ import weaver.hrm.User;
import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
@ -377,9 +378,7 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
String remarkI18n = SalaryI18nUtil.getI18nLabel(140036, "发放说明");
if (StringUtils.isNotEmpty(salaryTemplate.getTextContent())) {
String yearI18n = SalaryI18nUtil.getI18nLabel(100325, "");
String monthI18n = SalaryI18nUtil.getI18nLabel(100326, "");
salaryTemplate.setTextContent(salaryTemplate.getTextContent().replace("${salaryMonth}", salaryMonth.getYear() + yearI18n + salaryMonth.getMonth() + monthI18n));
salaryTemplate.setTextContent(salaryTemplate.getTextContent().replace("${salaryMonth}", new SimpleDateFormat("yyyy年MM月").format(salaryMonth)));
}
// 工资单水印设置

View File

@ -439,6 +439,7 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
List<FormulaVar> formulaVars = getSalaryFormulaService(user).listVarByFormulaIds(usingFormulaIds);
List<String> itemCode = formulaVars.stream()
.map(FormulaVar::getFieldId)
.map(v -> v.replaceAll("variableItem_", ""))
.map(v -> v.replaceAll("salaryItem_", ""))
.map(v -> v.replaceAll("salaryArchives_", ""))
.map(v -> v.replaceAll("ISSUED_", ""))

View File

@ -0,0 +1,78 @@
package com.engine.salary.service.impl;
import com.engine.core.impl.Service;
import com.engine.salary.entity.datacollection.po.VariableArchiveItemPO;
import com.engine.salary.mapper.datacollection.VariableArchiveItemMapper;
import com.engine.salary.service.VariableArchiveItemService;
import com.engine.salary.util.db.MapperProxyFactory;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import java.util.Collections;
import java.util.List;
/**
* @author Harryxzy
* @ClassName VariableArchiveItemServiceImpl
* @date 2024/08/07 9:29
* @description 浮动薪酬档案明细
*/
public class VariableArchiveItemServiceImpl extends Service implements VariableArchiveItemService {
private VariableArchiveItemMapper getVariableArchiveItemMapper(){
return MapperProxyFactory.getProxy(VariableArchiveItemMapper.class);
}
/**
* 根据浮动薪资档案id获取
*
* @param variableArchiveIds
* @return
*/
@Override
public List<VariableArchiveItemPO> listByVariableArchiveIds(List<Long> variableArchiveIds) {
if (CollectionUtils.isEmpty(variableArchiveIds)) {
return Collections.emptyList();
}
return getVariableArchiveItemMapper().listSome(VariableArchiveItemPO.builder().variableArchiveIds(variableArchiveIds).build());
}
/**
* 查询浮动薪酬档案中已使用的浮动薪资项目
*
* @return
*/
@Override
public List<Long> listUsingItems() {
return getVariableArchiveItemMapper().listUsingItems();
}
@Override
public int batchInsert(List<VariableArchiveItemPO> insertList) {
if (CollectionUtils.isEmpty(insertList)) {
return 0;
}
List<List<VariableArchiveItemPO>> partition = Lists.partition(insertList, 50);
partition.forEach(part -> getVariableArchiveItemMapper().batchInsert(part));
return 0;
}
@Override
public void deleteByArchiveIds(List<Long> variableArchiveIds) {
if (CollectionUtils.isEmpty(variableArchiveIds)) {
return;
}
List<List<Long>> partition = Lists.partition(variableArchiveIds, 500);
partition.forEach(part -> getVariableArchiveItemMapper().deleteByArchiveIds(part));
}
@Override
public void deleteByIds(List<Long> variableArchiveItemIds) {
if (CollectionUtils.isEmpty(variableArchiveItemIds)) {
return;
}
List<List<Long>> partition = Lists.partition(variableArchiveItemIds, 500);
partition.forEach(part -> getVariableArchiveItemMapper().deleteByIds(part));
}
}

View File

@ -0,0 +1,605 @@
package com.engine.salary.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.constant.SalaryItemConstant;
import com.engine.salary.entity.datacollection.bo.VariableArchiveBO;
import com.engine.salary.entity.datacollection.bo.VariableArchiveExcelBO;
import com.engine.salary.entity.datacollection.dto.VariableArchiveListDTO;
import com.engine.salary.entity.datacollection.dto.VariableItemListDTO;
import com.engine.salary.entity.datacollection.param.VariableArchiveImportHandleParam;
import com.engine.salary.entity.datacollection.param.VariableArchiveQueryParam;
import com.engine.salary.entity.datacollection.param.VariableArchiveSaveParam;
import com.engine.salary.entity.datacollection.po.VariableArchiveItemPO;
import com.engine.salary.entity.datacollection.po.VariableArchivePO;
import com.engine.salary.entity.datacollection.po.VariableItemPO;
import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveInitImportDTO;
import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.datacollection.UseEmployeeTypeEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.datacollection.VariableArchiveMapper;
import com.engine.salary.service.*;
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.db.IdGenerator;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.excel.*;
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.Maps;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.util.IOUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.file.ImageFileManager;
import weaver.general.Util;
import weaver.hrm.User;
import java.io.InputStream;
import java.time.YearMonth;
import java.util.*;
import java.util.stream.Collectors;
import static com.engine.salary.util.excel.ExcelSupport.EXCEL_TYPE_XLSX;
/**
* @author Harryxzy
* @ClassName VariableArchiveServiceImpl
* @date 2024/08/06 17:40
* @description 浮动薪酬档案
*/
public class VariableArchiveServiceImpl extends Service implements VariableArchiveService {
private VariableArchiveMapper getVariableArchiveMapper() {
return MapperProxyFactory.getProxy(VariableArchiveMapper.class);
}
private TaxAgentService getTaxAgentService(User user) {
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
}
public SalarySysConfService getSalarySysConfService(User user) {
return ServiceUtil.getService(SalarySysConfServiceImpl.class, user);
}
private VariableArchiveItemService getVariableArchiveItemService(User user) {
return ServiceUtil.getService(VariableArchiveItemServiceImpl.class, user);
}
private VariableItemService getVariableItemService(User user) {
return ServiceUtil.getService(VariableItemServiceImpl.class, user);
}
private SalaryEmployeeService getSalaryEmployeeService(User user) {
return (SalaryEmployeeService) ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
}
private int deleteByIds(List<Long> deleteIds) {
if (CollectionUtils.isEmpty(deleteIds)) {
return 0;
}
return getVariableArchiveMapper().deleteByIds(deleteIds);
}
/**
* 浮动薪酬档案列表
*
* @param queryParam
* @return
*/
@Override
public PageInfo<VariableArchiveListDTO> listPage(VariableArchiveQueryParam queryParam) {
List<VariableArchiveListDTO> variableArchiveList = list(queryParam);
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), variableArchiveList, VariableArchiveListDTO.class);
}
@Override
public List<VariableArchiveListDTO> list(VariableArchiveQueryParam queryParam) {
ValidUtil.doValidator(queryParam);
Long employeeId = Long.valueOf(user.getUID());
// 判断是否是总管理员
Boolean isChief = getTaxAgentService(user).isChief(employeeId);
// 是否开启分权
Boolean openDevolution = getTaxAgentService(user).isOpenDevolution();
if (BooleanUtils.isTrue(openDevolution) && !isChief) {
Collection<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId);
List<Long> taxAgentIds = taxAgentPOS.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(taxAgentIds)) {
// 无权限
return Collections.emptyList();
}
if (CollectionUtils.isNotEmpty(queryParam.getTaxAgentIds())) {
taxAgentIds = taxAgentIds.stream().filter(queryParam.getTaxAgentIds()::contains).collect(Collectors.toList());
}
queryParam.setTaxAgentIds(taxAgentIds);
}
// 浮动薪酬档案列表
if (Objects.nonNull(queryParam.getSalaryMonth())) {
queryParam.setSalaryMonthDate(SalaryDateUtil.dateStrToLocalYearMonth(queryParam.getSalaryMonth()));
}
//排序配置
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
queryParam.setOrderRule(orderRule);
return listDTO(queryParam);
}
public List<VariableArchiveListDTO> listDTO(VariableArchiveQueryParam queryParam) {
List<VariableArchiveListDTO> list = getVariableArchiveMapper().list(queryParam);
SalaryI18nUtil.i18nList(list);
return list;
}
/**
* 构建浮动薪资档案数据
*
* @param variableArchives
* @return
*/
@Override
public List<Map<String, Object>> buildVariableArchiveData(Collection<VariableArchiveListDTO> variableArchives) {
if (CollectionUtils.isEmpty(variableArchives)) {
// 无数据
}
List<Long> variableArchiveIds = variableArchives.stream().map(VariableArchiveListDTO::getId).collect(Collectors.toList());
// 获取浮动薪资档案所对应的浮动薪资项目数据
List<VariableArchiveItemPO> variableArchiveItemList = getVariableArchiveItemService(user).listByVariableArchiveIds(variableArchiveIds);
Map<Long, List<VariableArchiveItemPO>> variableArchiveItemMap = SalaryEntityUtil.group2Map(variableArchiveItemList, VariableArchiveItemPO::getVariableArchiveId);
List<Map<String, Object>> variableArchiveItemData = variableArchives.stream().map(m -> {
Map<String, Object> map = Maps.newHashMap();
map.put("variableArchiveId", m.getId());
List<VariableArchiveItemPO> variableArchiveItemValuelList = variableArchiveItemMap.getOrDefault(m.getId(), Collections.emptyList());
variableArchiveItemValuelList.forEach(i -> {
map.put(i.getVariableItemId() + SalaryItemConstant.VARIABLE_ITEM_DYNAMIC_SUFFIX, i.getItemValue());
});
return map;
}).collect(Collectors.toList());
// 组装数据
List<Map<String, Object>> listMaps = new ArrayList<>();
variableArchives.forEach(e -> {
Map<String, Object> map = new LinkedHashMap<>();
map.put("id", e.getId());
map.put("taxAgentName", e.getTaxAgentName());
map.put("taxAgentIds", e.getTaxAgentId());
map.put("username", e.getUsername());
map.put("salaryMonth", SalaryDateUtil.getFormatYearMonth(e.getSalaryMonth()));
map.put("employeeId", e.getEmployeeId());
map.put("subcompanyName", e.getSubcompanyName());
map.put("departmentName", e.getDepartmentName());
map.put("mobile", e.getMobile());
map.put("workcode", e.getWorkcode());
map.put("idNo", e.getIdNo());
map.put("companystartdate", e.getCompanystartdate());
map.put("dismissdate", e.getDismissdate());
// 浮动薪资项目动态
Optional<Map<String, Object>> optionalItem = variableArchiveItemData.stream().filter(f -> f.get("variableArchiveId").toString().equals(e.getId().toString())).findFirst();
optionalItem.ifPresent(map::putAll);
listMaps.add(map);
});
return listMaps;
}
/**
* 创建浮动薪酬档案
*
* @param saveParam
*/
@Override
public void createData(VariableArchiveSaveParam saveParam) {
ValidUtil.doValidator(saveParam);
saveParam.setSalaryMonthDate(SalaryDateUtil.dateStrToLocalYearMonth(saveParam.getSalaryMonth()));
List<VariableArchivePO> variableArchivePOList = getVariableArchiveMapper().listSome(VariableArchivePO.builder().salaryMonth(saveParam.getSalaryMonthDate()).taxAgentId(saveParam.getTaxAgentIds()).employeeId(saveParam.getEmployeeId()).build());
if (CollectionUtils.isNotEmpty(variableArchivePOList)) {
// 先删除原有档案
List<Long> variableArchiveIds = variableArchivePOList.stream().map(VariableArchivePO::getId).collect(Collectors.toList());
getVariableArchiveMapper().deleteByIds(variableArchiveIds);
}
// 保存浮动薪资档案信息
Date now = new Date();
VariableArchivePO variableArchivePO = VariableArchivePO.builder()
.id(IdGenerator.generate())
.employeeId(saveParam.getEmployeeId())
.taxAgentId(saveParam.getTaxAgentIds())
.salaryMonth(saveParam.getSalaryMonthDate())
.creator((long) user.getUID())
.createTime(now)
.updateTime(now)
.deleteType(NumberUtils.INTEGER_ZERO)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build();
getVariableArchiveMapper().insertIgnoreNull(variableArchivePO);
// 保存浮动薪资档案详细信息
List<VariableArchiveItemPO> variableArchiveItemList = new ArrayList<>();
if(CollectionUtil.isNotEmpty(saveParam.getItemValueList())){
saveParam.getItemValueList().forEach(e -> {
variableArchiveItemList.add(VariableArchiveItemPO.builder()
.id(IdGenerator.generate())
.employeeId(saveParam.getEmployeeId())
.variableArchiveId(variableArchivePO.getId())
.variableItemId(e.getVariableItemId())
.itemValue(e.getItemValue())
.creator((long) user.getUID())
.createTime(now)
.updateTime(now)
.deleteType(NumberUtils.INTEGER_ZERO)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build());
});
}
if (CollectionUtils.isNotEmpty(variableArchiveItemList)) {
getVariableArchiveItemService(user).batchInsert(variableArchiveItemList);
}
}
/**
* 浮动薪资档案明细
*
* @param queryParam
* @return
*/
@Override
public Map<String, Object> getDetail(VariableArchiveQueryParam queryParam) {
if (queryParam.getId() == null) {
return Collections.emptyMap();
}
List<VariableArchiveListDTO> variableArchiveList = listDTO(queryParam);
// 获取所有浮动薪酬项目
List<VariableItemPO> variableItems = getVariableItemService(user).listAll();
//整合所有的显示列固定列+薪资项目动态列
List<Map<String, Object>> listMaps = buildVariableArchiveData(variableArchiveList);
Map<String, Object> resultMap = listMaps.get(0);
//动态列组装
List<WeaTableColumn> columns = VariableArchiveBO.buildVariableArchiveTable(variableItems);
columns.add(0, new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(85429, "薪资所属月"), "salaryMonth"));
Map<String, Object> datas = new HashMap<>();
datas.put("data", resultMap);
datas.put("column", columns);
return datas;
}
@Override
public List<VariableItemListDTO> getCreateForm() {
List<VariableItemPO> variableItemPOS = getVariableItemService(user).listAll();
List<VariableItemListDTO> variableItemDTOList = variableItemPOS.stream()
.map(po -> VariableItemListDTO.builder()
.id(po.getId())
.name(po.getName())
.build())
.collect(Collectors.toList());
return variableItemDTOList;
}
@Override
public XSSFWorkbook downloadTemplate(VariableArchiveQueryParam param) {
// 名称
String nameI18n = SalaryI18nUtil.getI18nLabel(0, "浮动薪酬导入模板");
// 获取所有可被引用的薪资项目
List<VariableItemPO> variableItems = getVariableItemService(user).listAll();
List<Object> header = Lists.newArrayList();
header.add(SalaryI18nUtil.getI18nLabel(0, "个税扣缴义务人"));
header.add(SalaryI18nUtil.getI18nLabel(85429, "姓名"));
header.add(SalaryI18nUtil.getI18nLabel(86185, "部门"));
header.add(SalaryI18nUtil.getI18nLabel(86186, "手机号"));
header.add(SalaryI18nUtil.getI18nLabel(1933, "工号"));
header.add(SalaryI18nUtil.getI18nLabel(86186, "证件号码"));
header.add(SalaryI18nUtil.getI18nLabel(86187, "入职日期"));
for (VariableItemPO variableItem : variableItems) {
header.add(variableItem.getName());
}
// 2.表头
List<List<Object>> rows = new ArrayList<>();
rows.add(header);
// 获取档案信息
List<VariableArchiveListDTO> variableArchiveList = list(param);
if (param.isHasData()) {
List<Map<String, Object>> listMaps = buildVariableArchiveData(variableArchiveList);
// 组装数据
listMaps.forEach(e -> {
List<Object> row = new ArrayList<>();
row.add(e.get("taxAgentName").toString());
row.add(e.get("username").toString());
row.add(Optional.ofNullable(e.get("departmentName")).orElse("").toString());
row.add(e.get("mobile") == null ? "" : e.get("mobile").toString());
row.add(Optional.ofNullable(e.get("workcode")).orElse("").toString());
row.add(Util.null2String(e.get("idNo")));
row.add(Util.null2String(e.get("companystartdate")));
// 薪资项目数据
for (VariableItemPO variableItem : variableItems) {
row.add(e.containsKey(variableItem.getId() + SalaryItemConstant.VARIABLE_ITEM_DYNAMIC_SUFFIX) ? (e.get(variableItem.getId() + SalaryItemConstant.VARIABLE_ITEM_DYNAMIC_SUFFIX) == null ? ""
: e.get(variableItem.getId() + SalaryItemConstant.VARIABLE_ITEM_DYNAMIC_SUFFIX).toString()) : "");
}
rows.add(row);
});
}
// 4.注释
List<ExcelComment> excelComments = Lists.newArrayList();
return ExcelUtilPlus.genWorkbookV2(rows, nameI18n, excelComments);
}
@Override
public ExcelPreviewDTO preview(VariableArchiveImportHandleParam importParam) {
//excel文件id
String imageId = Util.null2String(importParam.getImageId());
InputStream fileInputStream = null;
try {
fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(imageId));
return ExcelParseHelper.preview(fileInputStream, 0, EXCEL_TYPE_XLSX);
} finally {
IOUtils.closeQuietly(fileInputStream);
}
}
@Override
public Map<String, Object> importData(VariableArchiveImportHandleParam importParam) {
// 初始化国际化标签
VariableArchiveExcelBO.initI18n();
// 校验参数
checkImportParam(importParam);
String imageId = importParam.getImageId();
// 构建导入处理参数
importParam = buildImportHandleParam(importParam);
// 导入有重复
List<String> allTodoVariableArchives = Lists.newArrayList();
InputStream fileInputStream = null;
try {
fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(imageId));
Workbook workbook = ExcelSupport.parseFile(fileInputStream, EXCEL_TYPE_XLSX);
Sheet sheet = workbook.getSheetAt(0);
List<String> headers = ExcelSupport.getSheetHeader(sheet, 0);
int total = 0;
//excel数据
List<Map<String, Object>> data = ExcelParseHelper.parse2Map(workbook, 0, 1);
if (data != null) {
total += data.size();
}
int index = 0;
int successCount = 0;
int errorCount = 0;
// 用于初始化导入的相同employeeId时的处理
List<SalaryArchiveInitImportDTO> initImportData = Lists.newArrayList();
// 错误提示
List<Map<String, String>> excelComments = new ArrayList<>();
// 错误sheet数据
List<Map<String, Object>> errorData = new ArrayList<>();
Map<String, Object> map;
for (int i = 0; i < data.size(); i++) {
index += 1;
map = data.get(i);
map.put("index", i + 2);
// 3.校验行内容
boolean isError = VariableArchiveExcelBO.singleRowCheck(allTodoVariableArchives, map, headers, excelComments, errorCount, importParam, user);
if (isError) {
errorCount += 1;
// 添加错误数据
errorData.add(map);
} else {
successCount += 1;
}
}
// 4.数据入库处理
handleImportData(importParam);
Map<String, Object> apidatas = new HashMap<>();
apidatas.put("successCount", successCount);
apidatas.put("errorCount", errorCount);
apidatas.put("errorNotice", excelComments);
return apidatas;
} finally {
IOUtils.closeQuietly(fileInputStream);
}
}
private void checkImportParam(VariableArchiveImportHandleParam importParam) {
//excel文件id
String imageId = Util.null2String(importParam.getImageId());
//税款所属期
String salaryMonthStr = Util.null2String(importParam.getSalaryMonth());
if (StringUtils.isBlank(imageId)) {
throw new SalaryRunTimeException("文件不存在");
}
if (StringUtils.isBlank(salaryMonthStr)) {
throw new SalaryRunTimeException("薪资所属月为空");
}
}
/**
* 构建导入处理参数
*
* @param param
* @return
*/
private VariableArchiveImportHandleParam buildImportHandleParam(VariableArchiveImportHandleParam param) {
// 获取所有可被引用的浮动薪资项目
List<VariableItemPO> variableItems = getVariableItemService(user).listAll();
Collection<Long> variableItemIds = variableItems.stream().map(VariableItemPO::getId).collect(Collectors.toList());
List<VariableArchivePO> variableArchiveList = getVariableArchiveMapper().listSome(VariableArchivePO.builder().salaryMonth(SalaryDateUtil.dateStrToLocalYearMonth(param.getSalaryMonth())).build());
List<Long> variableArchiveIds = variableArchiveList.stream().map(VariableArchivePO::getId).collect(Collectors.toList());
Map<String, VariableArchivePO> variableArchivesMap = SalaryEntityUtil.convert2Map(variableArchiveList, k -> k.getTaxAgentId() + "-" + k.getEmployeeId());
// 获取浮动薪资档案明细数据
List<VariableArchiveItemPO> variableArchiveItemPOS = getVariableArchiveItemService(user).listByVariableArchiveIds(variableArchiveIds);
Map<String, List<VariableArchiveItemPO>> variableArchiveItemMap = SalaryEntityUtil.group2Map(variableArchiveItemPOS, k -> k.getVariableArchiveId() + "-" + k.getVariableItemId());
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList;
taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree((long) user.getUID());
return VariableArchiveImportHandleParam.builder()
.imageId(param.getImageId())
.salaryMonth(param.getSalaryMonth())
.salaryMonthDate(SalaryDateUtil.dateStrToLocalYearMonth(param.getSalaryMonth()))
.currentEmployeeId((long) user.getUID())
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
//人员定位方式
.empValidType(getSalaryEmployeeService(user).empValidType())
// 获取租户下所有的人员
.employees(getSalaryEmployeeService(user).listAll(UseEmployeeTypeEnum.ORG))
// 浮动薪资项目
.variableItems(variableItems)
// 查询已有的浮动薪资档案基本数据
.variableArchivesMap(variableArchivesMap)
// 浮动薪资项目id
.variableItemIds(variableItemIds)
// 查询已生效的浮动薪资项目数据
.effectiveItemListMap(variableArchiveItemMap)
// 可以管理的义务人
.taxAgentList(taxAgentList)
// 当前时间
.nowTime(new Date())
// 当天
.today(new Date())
// 待保存浮动薪资档案
.variableArchiveSaves(Lists.newArrayList())
// 待保存浮动薪资档案-浮动薪资项目
.variableArchiveItemSaves(Lists.newArrayList())
// 待删除浮动薪资档案-浮动薪资项目
.variableArchiveItemDelSalaryItemIds(Lists.newArrayList())
.build();
}
private void handleImportData(VariableArchiveImportHandleParam importHandleParam) {
List<VariableArchivePO> variableArchiveSaves = importHandleParam.getVariableArchiveSaves();
List<VariableArchiveItemPO> variableArchiveItemSaves = importHandleParam.getVariableArchiveItemSaves();
List<Long> variableArchiveItemDelSalaryItemIds = importHandleParam.getVariableArchiveItemDelSalaryItemIds();
// 新增档案
if (CollectionUtils.isNotEmpty(variableArchiveSaves)) {
variableArchiveSaves.stream().forEach(getVariableArchiveMapper()::insertIgnoreNull);
}
// 薪资档案-薪资项目
if (CollectionUtils.isNotEmpty(variableArchiveItemDelSalaryItemIds)) {
getVariableArchiveItemService(user).deleteByIds(variableArchiveItemDelSalaryItemIds);
}
// 薪资档案-薪资项目
if (CollectionUtils.isNotEmpty(variableArchiveItemSaves)) {
getVariableArchiveItemService(user).batchInsert(variableArchiveItemSaves);
}
}
@Override
public XSSFWorkbook export(VariableArchiveQueryParam param) {
// 名称
String nameI18n = SalaryI18nUtil.getI18nLabel(0, "浮动薪酬");
// 获取所有可被引用的薪资项目
List<VariableItemPO> variableItems = getVariableItemService(user).listAll();
List<WeaTableColumn> header = VariableArchiveBO.buildVariableArchiveTable(variableItems);
Map<String, WeaTableColumn> columnMap = SalaryEntityUtil.convert2Map(header, WeaTableColumn::getColumn);
List<WeaTableColumn> finalColumns = new ArrayList<>();
param.getColumns().forEach(col -> {
WeaTableColumn column = columnMap.get(col);
if (column != null) {
finalColumns.add(column);
}
});
header = finalColumns;
// 2.表头
List<List<Object>> rows = new ArrayList<>();
rows.add(header.stream().map(WeaTableColumn::getText).collect(Collectors.toList()));
// 获取档案信息
List<VariableArchiveListDTO> variableArchiveList = list(param);
List<Map<String, Object>> listMaps = buildVariableArchiveData(variableArchiveList);
// 组装数据
List<WeaTableColumn> finalHeader = header;
listMaps.forEach(e -> {
List<Object> row = new ArrayList<>();
for (WeaTableColumn column : finalHeader) {
row.add(Util.null2String(e.get(column.getColumn())));
}
// row.add(e.get("salaryMonth").toString());
// row.add(e.get("taxAgentName").toString());
// row.add(e.get("username").toString());
// row.add(Optional.ofNullable(e.get("departmentName")).orElse("").toString());
// row.add(e.get("mobile") == null ? "" : e.get("mobile").toString());
// row.add(Optional.ofNullable(e.get("workcode")).orElse("").toString());
// row.add(Util.null2String(e.get("idNo")));
// row.add(Util.null2String(e.get("companystartdate")));
//
// // 薪资项目数据
// for (VariableItemPO variableItem : variableItems) {
// row.add(e.containsKey(variableItem.getId() + SalaryItemConstant.VARIABLE_ITEM_DYNAMIC_SUFFIX) ? (e.get(variableItem.getId() + SalaryItemConstant.VARIABLE_ITEM_DYNAMIC_SUFFIX) == null ? ""
// : e.get(variableItem.getId() + SalaryItemConstant.VARIABLE_ITEM_DYNAMIC_SUFFIX).toString()) : "");
// }
rows.add(row);
});
// 4.注释
List<ExcelComment> excelComments = Lists.newArrayList();
return ExcelUtilPlus.genWorkbookV2(rows, nameI18n, excelComments);
}
@Override
public void deleteSelectVariableArchive(Collection<Long> deleteIds) {
if (CollectionUtils.isEmpty(deleteIds)) {
return;
}
List<VariableArchivePO> variableArchivePOList = getVariableArchiveMapper().listSome(VariableArchivePO.builder().ids(deleteIds).build());
List<Long> archiveIds = variableArchivePOList.stream().map(VariableArchivePO::getId).collect(Collectors.toList());
deleteByIds(archiveIds);
// 删除明细
getVariableArchiveItemService(user).deleteByArchiveIds(archiveIds);
}
@Override
public List<Map<String, Object>> listBySalaryMonthAndEmployeeIds(YearMonth salaryMonth, List<Long> employeeIds, Long taxAgentId) {
VariableArchiveQueryParam queryParam = VariableArchiveQueryParam.builder()
.employeeIds(employeeIds)
.salaryMonth(SalaryDateUtil.getFormatYearMonth(salaryMonth))
.salaryMonthDate(SalaryDateUtil.toDate(salaryMonth, 1))
.taxAgentIds(Collections.singletonList(taxAgentId))
.build();
List<VariableArchiveListDTO> variableArchiveListDTO = list(queryParam);
return buildVariableArchiveData(variableArchiveListDTO);
}
}

View File

@ -0,0 +1,260 @@
package com.engine.salary.service.impl;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.datacollection.dto.VariableItemListDTO;
import com.engine.salary.entity.datacollection.param.VariableItemQueryParam;
import com.engine.salary.entity.datacollection.param.VariableItemSaveParam;
import com.engine.salary.entity.datacollection.po.VariableItemPO;
import com.engine.salary.entity.salaryformula.po.FormulaPO;
import com.engine.salary.entity.salaryformula.po.FormulaVar;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.datacollection.VariableItemMapper;
import com.engine.salary.service.*;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
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.RuntimeTypeEnum;
import com.engine.salary.util.valid.ValidUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.beans.BeanUtils;
import weaver.conn.util.IdGenerator;
import weaver.hrm.User;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author Harryxzy
* @ClassName VariableItemServiceImpl
* @date 2024/08/07 9:31
* @description 浮动薪酬项目
*/
public class VariableItemServiceImpl extends Service implements VariableItemService {
private VariableItemMapper getVariableItemMapper(){
return MapperProxyFactory.getProxy(VariableItemMapper.class);
}
private SalaryFormulaService getSalaryFormulaService(User user) {
return ServiceUtil.getService(SalaryFormulaServiceImpl.class, user);
}
private SalaryItemService getSalaryItemService(User user) {
return ServiceUtil.getService(SalaryItemServiceImpl.class, user);
}
private VariableArchiveItemService getVariableArchiveItemService(User user) {
return ServiceUtil.getService(VariableArchiveItemServiceImpl.class, user);
}
private TaxAgentService getTaxAgentService(User user) {
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
}
@Override
public VariableItemPO getById(Long id) {
if (id == null) {
return null;
}
return getVariableItemMapper().getById(id);
}
@Override
public List<VariableItemPO> listByIds(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return Collections.emptyList();
}
return getVariableItemMapper().listSome(VariableItemPO.builder().ids(ids).build());
}
/**
* 获取浮动薪酬项目
* @return
*/
@Override
public List<VariableItemPO> listAll() {
return getVariableItemMapper().listAll();
}
/**
* 获取浮动薪资项目列表分页
*
* @param queryParam
* @return
*/
@Override
public PageInfo<VariableItemListDTO> listPage(VariableItemQueryParam queryParam) {
List<VariableItemPO> variableItemPOS = listAll();
Long employeeId = Long.valueOf(user.getUID());
// 判断是否是总管理员
Boolean isChief = getTaxAgentService(user).isChief(employeeId);
// 是否开启分权
Boolean openDevolution = getTaxAgentService(user).isOpenDevolution();
if (BooleanUtils.isTrue(openDevolution) && !isChief) {
Collection<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId);
List<Long> taxAgentIds = taxAgentPOS.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(taxAgentIds)) {
// 无权限
return new PageInfo<>();
}
}
if (StringUtils.isNotBlank(queryParam.getItemName())) {
variableItemPOS = variableItemPOS.stream().filter(po -> po.getName().contains(queryParam.getItemName())).collect(Collectors.toList());
}
// 查询不可删除的codeid
SalaryItemServiceImpl.UsingItem usingItem = getSalaryItemService(user).getUsingItem();
List<String> usingCodes = usingItem.getUsingCodes();
List<Long> usingVariableItemIds = getVariableArchiveItemService(user).listUsingItems();
List<VariableItemListDTO> variableItemDTOList = variableItemPOS.stream()
.map(po -> VariableItemListDTO.builder()
.id(po.getId())
.name(po.getName())
.dataType(SalaryDataTypeEnum.parseByValue(po.getDataType()).getDefaultLabel())
.canDelete( !(usingCodes.contains(po.getCode()) || usingVariableItemIds.contains(po.getId())) )
.build())
.collect(Collectors.toList());
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), variableItemDTOList, VariableItemListDTO.class);
}
private List<VariableItemPO> listByName(String name) {
return getVariableItemMapper().listSome(VariableItemPO.builder().name(name).build());
}
@Override
public Integer save(VariableItemSaveParam saveParam) {
// 名称不能和已有的自定义薪资项目重名
List<VariableItemPO> variableItemPOS = listByName(saveParam.getName());
if (CollectionUtils.isNotEmpty(variableItemPOS)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "项目名称已存在,请重新命名"));
}
Date now = new Date();
long id = com.engine.salary.util.db.IdGenerator.generate();
VariableItemPO variableItemPO = VariableItemPO.builder()
.id(id)
.name(saveParam.getName())
.code(IdGenerator.getUUID())
.dataType(saveParam.getDataType())
.creator(Long.valueOf(user.getUID()))
.deleteType(NumberUtils.INTEGER_ZERO)
.createTime(now)
.updateTime(now)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build();
return getVariableItemMapper().insertIgnoreNull(variableItemPO);
}
@Override
public VariableItemPO update(VariableItemSaveParam saveParam) {
ValidUtil.doValidator(saveParam, RuntimeTypeEnum.UPDATE);
// 查询薪资项目判断薪资项目是否存在
VariableItemPO variableItemPO = getById(saveParam.getId());
if (Objects.isNull(variableItemPO)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "参数错误,项目不存在或已被删除"));
}
// 名称不能和已有的自定义薪资项目重名
List<VariableItemPO> variableItemPOS = listByName(saveParam.getName());
boolean nameExist = variableItemPOS.stream().anyMatch(e -> !Objects.equals(saveParam.getId(), e.getId()));
if (nameExist) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98326, "项目名称已存在,请重新命名"));
}
// 更新薪资项目
VariableItemPO newVariableItemPO = new VariableItemPO();
BeanUtils.copyProperties(variableItemPO, newVariableItemPO);
newVariableItemPO.setName(saveParam.getName());
newVariableItemPO.setDataType(saveParam.getDataType());
newVariableItemPO.setUpdateTime(new Date());
getVariableItemMapper().update(newVariableItemPO);
//改名后更新公式
String oldName = variableItemPO.getName();
String newName = saveParam.getName();
if (!StringUtils.equals(oldName, newName)) {
String itemPrefix = "variableItem_";
String fieldNamePrefix = "{浮动薪资项目.%s}";
changeName(variableItemPO, oldName, newName, itemPrefix, fieldNamePrefix);
}
return variableItemPO;
}
private void changeName(VariableItemPO variableItemPO, String oldName, String newName, String itemPrefix, String fieldNamePrefix) {
String code = itemPrefix + variableItemPO.getCode();
Date now = new Date();
List<FormulaVar> formulaVars = getSalaryFormulaService(user).listByCode(code);
formulaVars.forEach(v -> {
FormulaVar formulaVar = FormulaVar.builder()
.id(v.getId())
.name(newName)
.fieldName(String.format(fieldNamePrefix, newName))
.updateTime(now)
.build();
getSalaryFormulaService(user).updateVar(formulaVar);
});
List<Long> formulaIds = SalaryEntityUtil.properties(formulaVars, FormulaVar::getFormulaId, Collectors.toList());
List<FormulaPO> formulaPOS = getSalaryFormulaService(user).listByIds(formulaIds);
formulaPOS.forEach(f -> {
String formula = f.getFormula();
formula = formula.replace(String.format(fieldNamePrefix, oldName), String.format(fieldNamePrefix, newName));
FormulaPO formulaPO = FormulaPO.builder()
.id(f.getId())
.formula(formula)
.updateTime(now)
.build();
getSalaryFormulaService(user).update(formulaPO);
});
}
@Override
public void deleteItems(List<Long> itemIds) {
if (CollectionUtils.isEmpty(itemIds)) {
return;
}
SalaryItemServiceImpl.UsingItem usingItem = getSalaryItemService(user).getUsingItem();
List<String> usingCodes = usingItem.getUsingCodes();
// 查询薪资项目
List<VariableItemPO> variableItemPOS = listByIds(itemIds);
if (CollectionUtils.isEmpty(variableItemPOS)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "参数错误,浮动薪资项目不存在或已被删除"));
}
List<String> codes = SalaryEntityUtil.properties(variableItemPOS, VariableItemPO::getCode, Collectors.toList());
if (CollectionUtils.containsAny(usingCodes, codes)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "公式正在使用该浮动薪资项目,不允许删除"));
}
// 查询浮动薪酬档案中已使用的浮动薪资项目
List<Long> usingVariableItemIds = getVariableArchiveItemService(user).listUsingItems();
if (CollectionUtils.containsAny(usingVariableItemIds, itemIds)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "浮动薪资档案中正在使用该薪资项目,不允许删除"));
}
itemIds.stream().forEach(id -> getVariableItemMapper().delete(VariableItemPO.builder().id(id).build()));
;
}
@Override
public VariableItemListDTO getDetail(Long id) {
if (id == null) {
return null;
}
VariableItemPO variableItemPO = getVariableItemMapper().getById(id);
return VariableItemListDTO.builder()
.id(variableItemPO.getId())
.name(variableItemPO.getName())
.dataType(variableItemPO.getDataType())
.build();
}
}

View File

@ -18,7 +18,8 @@ public enum OrderRuleEnum implements BaseEnum<String> {
LASTNAME("e.lastName", "人员名称", 1),
DEPTNAME("d.departmentname", "部门名称", 1),
SUBCOMNAME("c.subcompanyname", "分部名称", 1),
SHOWORDEROFDEPTTREE("d.showOrderOfTree", "组织", 1);
SHOWORDEROFDEPTTREE("d.showOrderOfTree", "组织", 1),
WORKCODE("e.workcode", "工号", 1);
private String value;

View File

@ -248,13 +248,13 @@ public class SalaryAcctController {
return new ResponseResult<Long, String>(user).run(getSalaryAcctEmployeeWrapper(user)::checkTaxAgent, param.getSalaryAcctRecordId());
}
//刷新薪资核算人员的个税扣缴义务人
//刷新薪资核算人员
@POST
@Path("/acctemployee/refreshTaxAgent")
@Path("/acctemployee/refresh")
@Produces(MediaType.APPLICATION_JSON)
public String refreshTaxAgent(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryAcctEmpRefreshTaxAgentParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long, String>(user).run(getSalaryAcctEmployeeWrapper(user)::refreshTaxAgent, param.getSalaryAcctRecordId());
return new ResponseResult<Long, String>(user).run(getSalaryAcctEmployeeWrapper(user)::refresh, param.getSalaryAcctRecordId());
}
//从环比上月减少添加薪资核算人员

Some files were not shown because too many files have changed in this diff Show More