账套快照

This commit is contained in:
钱涛 2024-05-06 16:03:29 +08:00
parent 7d7d2dc309
commit 3428de9e33
47 changed files with 1547 additions and 265 deletions

View File

@ -0,0 +1,19 @@
create table hrsa_salary_acct_sob_config
(
id number primary key ,
create_time date,
update_time date,
creator number,
delete_type int default 0,
tenant_key varchar2(10),
salary_acct_record_id number,
basic_config clob,
employee_field_config clob,
item_config clob,
item_group_config clob,
back_item_config clob,
adjust_rule_config clob,
check_rule_config clob
);
/

View File

@ -0,0 +1,12 @@
update hrsa_salary_sob_item set item_hide = 0;
/
update hrsa_salary_sob_item_group set item_hide = 0;
/
UPDATE hrsa_salary_sob_item a SET item_hide = (SELECT b.item_hide FROM hrsa_salary_item_hide b WHERE a.salary_item_id = b.salary_item_id and a.salary_sob_id = b.salary_sob_id and a.delete_type=0 and b.delete_type=0 ) WHERE EXISTS (SELECT 1 FROM hrsa_salary_item_hide b WHERE b.item_hide = a.item_hide);
/
UPDATE hrsa_salary_sob_item_group a SET item_hide = (SELECT b.item_hide FROM hrsa_salary_item_hide b WHERE a.id = b.salary_item_id and a.salary_sob_id = b.salary_sob_id and a.delete_type=0 and b.delete_type=0 ) WHERE EXISTS (SELECT 1 FROM hrsa_salary_item_hide b WHERE b.item_hide = a.item_hide);
/

View File

@ -0,0 +1,19 @@
create table hrsa_salary_acct_sob_config
(
id number primary key ,
create_time date,
update_time date,
creator number,
delete_type int default 0,
tenant_key varchar2(10),
salary_acct_record_id number,
basic_config clob,
employee_field_config clob,
item_config clob,
item_group_config clob,
back_item_config clob,
adjust_rule_config clob,
check_rule_config clob
);
/

View File

@ -0,0 +1,12 @@
update hrsa_salary_sob_item set item_hide = 0;
/
update hrsa_salary_sob_item_group set item_hide = 0;
/
UPDATE hrsa_salary_sob_item a SET item_hide = (SELECT b.item_hide FROM hrsa_salary_item_hide b WHERE a.salary_item_id = b.salary_item_id and a.salary_sob_id = b.salary_sob_id and a.delete_type=0 and b.delete_type=0 ) WHERE EXISTS (SELECT 1 FROM hrsa_salary_item_hide b WHERE b.item_hide = a.item_hide);
/
UPDATE hrsa_salary_sob_item_group a SET item_hide = (SELECT b.item_hide FROM hrsa_salary_item_hide b WHERE a.id = b.salary_item_id and a.salary_sob_id = b.salary_sob_id and a.delete_type=0 and b.delete_type=0 ) WHERE EXISTS (SELECT 1 FROM hrsa_salary_item_hide b WHERE b.item_hide = a.item_hide);
/

View File

@ -0,0 +1,19 @@
create table hrsa_salary_acct_sob_config
(
id number primary key ,
create_time date,
update_time date,
creator number,
delete_type int default 0,
tenant_key varchar2(10),
salary_acct_record_id number,
basic_config clob,
employee_field_config clob,
item_config clob,
item_group_config clob,
back_item_config clob,
adjust_rule_config clob,
check_rule_config clob
);
/

View File

@ -0,0 +1,12 @@
update hrsa_salary_sob_item set item_hide = 0;
/
update hrsa_salary_sob_item_group set item_hide = 0;
/
UPDATE hrsa_salary_sob_item a SET item_hide = (SELECT b.item_hide FROM hrsa_salary_item_hide b WHERE a.salary_item_id = b.salary_item_id and a.salary_sob_id = b.salary_sob_id and a.delete_type=0 and b.delete_type=0 ) WHERE EXISTS (SELECT 1 FROM hrsa_salary_item_hide b WHERE b.item_hide = a.item_hide);
/
UPDATE hrsa_salary_sob_item_group a SET item_hide = (SELECT b.item_hide FROM hrsa_salary_item_hide b WHERE a.id = b.salary_item_id and a.salary_sob_id = b.salary_sob_id and a.delete_type=0 and b.delete_type=0 ) WHERE EXISTS (SELECT 1 FROM hrsa_salary_item_hide b WHERE b.item_hide = a.item_hide);
/

View File

@ -0,0 +1,18 @@
create table hrsa_salary_acct_sob_config
(
id bigint primary key comment 'ID' ,
create_time datetime comment '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>' ,
update_time datetime comment '<EFBFBD>޸<EFBFBD>ʱ<EFBFBD><EFBFBD>' ,
creator bigint comment '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>id' ,
delete_type int default 0 comment '<EFBFBD>Ƿ<EFBFBD>ɾ<EFBFBD><EFBFBD>' ,
tenant_key varchar(10) comment '<EFBFBD>⻧KEY' ,
salary_acct_record_id bigint comment 'н<EFBFBD>ʺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>id' ,
basic_config text comment 'н<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׵Ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ' ,
employee_field_config text comment 'н<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׵<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>ֶ<EFBFBD>' ,
item_config text comment 'н<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׵<EFBFBD>н<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ' ,
item_group_config text comment 'н<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׵<EFBFBD>н<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' ,
back_item_config text comment 'н<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD>Ļ<EFBFBD><EFBFBD><EFBFBD>н<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ' ,
adjust_rule_config text comment 'н<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD>ĵ<EFBFBD>н<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' ,
check_rule_config text comment 'н<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD>У<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
)
;

View File

@ -0,0 +1,7 @@
update hrsa_salary_sob_item set item_hide = 0;
update hrsa_salary_sob_item_group set item_hide = 0;
update hrsa_salary_sob_item a INNER JOIN hrsa_salary_item_hide b on a.salary_item_id = b.salary_item_id and a.salary_sob_id = b.salary_sob_id set a.item_hide = b.item_hide where a.delete_type=0 and b.delete_type=0 and b.is_group=0 and b.item_hide is not null;
update hrsa_salary_sob_item_group a INNER JOIN hrsa_salary_item_hide b on a.id = b.salary_item_id and a.salary_sob_id = b.salary_sob_id set a.item_hide = b.item_hide where a.delete_type=0 and b.delete_type=0 and b.is_group=1 and b.item_hide is not null;

View File

@ -0,0 +1,18 @@
create table hrsa_salary_acct_sob_config
(
id number primary key ,
create_time date,
update_time date,
creator number,
delete_type int default 0,
tenant_key varchar2(10),
salary_acct_record_id number,
basic_config clob,
employee_field_config clob,
item_config clob,
item_group_config clob,
back_item_config clob,
adjust_rule_config clob,
check_rule_config clob
)
/

View File

@ -0,0 +1,9 @@
update hrsa_salary_sob_item set item_hide = 0
/
update hrsa_salary_sob_item_group set item_hide = 0
/
UPDATE hrsa_salary_sob_item a SET item_hide = (SELECT b.item_hide FROM hrsa_salary_item_hide b WHERE a.salary_item_id = b.salary_item_id and a.salary_sob_id = b.salary_sob_id and a.delete_type=0 and b.delete_type=0 ) WHERE EXISTS (SELECT 1 FROM hrsa_salary_item_hide b WHERE b.item_hide = a.item_hide)
/
UPDATE hrsa_salary_sob_item_group a SET item_hide = (SELECT b.item_hide FROM hrsa_salary_item_hide b WHERE a.id = b.salary_item_id and a.salary_sob_id = b.salary_sob_id and a.delete_type=0 and b.delete_type=0 ) WHERE EXISTS (SELECT 1 FROM hrsa_salary_item_hide b WHERE b.item_hide = a.item_hide)
/

View File

@ -0,0 +1,18 @@
create table hrsa_salary_acct_sob_config
(
id bigint primary key ,
create_time timestamp,
update_time timestamp,
creator bigint,
delete_type int default 0,
tenant_key varchar(10),
salary_acct_record_id bigint,
basic_config text,
employee_field_config text,
item_config text,
item_group_config text,
back_item_config text,
adjust_rule_config text,
check_rule_config text
);
/

View File

@ -0,0 +1,7 @@
update hrsa_salary_sob_item set item_hide = 0;
update hrsa_salary_sob_item_group set item_hide = 0;
UPDATE hrsa_salary_sob_item a SET item_hide = (SELECT b.item_hide FROM hrsa_salary_item_hide b WHERE a.salary_item_id = b.salary_item_id and a.salary_sob_id = b.salary_sob_id and a.delete_type=0 and b.delete_type=0 ) WHERE EXISTS (SELECT 1 FROM hrsa_salary_item_hide b WHERE b.item_hide = a.item_hide);
UPDATE hrsa_salary_sob_item_group a SET item_hide = (SELECT b.item_hide FROM hrsa_salary_item_hide b WHERE a.id = b.salary_item_id and a.salary_sob_id = b.salary_sob_id and a.delete_type=0 and b.delete_type=0 ) WHERE EXISTS (SELECT 1 FROM hrsa_salary_item_hide b WHERE b.item_hide = a.item_hide);

View File

@ -0,0 +1,18 @@
create table hrsa_salary_acct_sob_config
(
id bigint primary key ,
create_time datetime,
update_time datetime,
creator bigint,
delete_type int default 0,
tenant_key nvarchar(10),
salary_acct_record_id bigint,
basic_config ntext,
employee_field_config ntext,
item_config ntext,
item_group_config ntext,
back_item_config ntext,
adjust_rule_config ntext,
check_rule_config ntext
)
GO

View File

@ -0,0 +1,14 @@
update hrsa_salary_sob_item set item_hide = 0
GO
update hrsa_salary_sob_item_group set item_hide = 0
GO
UPDATE hrsa_salary_sob_item SET item_hide = b.item_hide FROM hrsa_salary_sob_item a INNER JOIN hrsa_salary_item_hide b ON a.salary_item_id = b.salary_item_id and a.salary_sob_id = b.salary_sob_id
WHERE a.delete_type=0 and b.delete_type=0 and b.is_group=0 and b.item_hide is not null
GO
UPDATE hrsa_salary_sob_item_group SET item_hide = b.item_hide FROM hrsa_salary_sob_item_group a INNER JOIN hrsa_salary_item_hide b ON a.id = b.salary_item_id and a.salary_sob_id = b.salary_sob_id
WHERE a.delete_type=0 and b.delete_type=0 and b.is_group=1 and b.item_hide is not null
GO

View File

@ -0,0 +1,19 @@
create table hrsa_salary_acct_sob_config
(
id number primary key ,
create_time date,
update_time date,
creator number,
delete_type int default 0,
tenant_key varchar2(10),
salary_acct_record_id number,
basic_config clob,
employee_field_config clob,
item_config clob,
item_group_config clob,
back_item_config clob,
adjust_rule_config clob,
check_rule_config clob
);
/

View File

@ -0,0 +1,12 @@
update hrsa_salary_sob_item set item_hide = 0;
/
update hrsa_salary_sob_item_group set item_hide = 0;
/
UPDATE hrsa_salary_sob_item a SET item_hide = (SELECT b.item_hide FROM hrsa_salary_item_hide b WHERE a.salary_item_id = b.salary_item_id and a.salary_sob_id = b.salary_sob_id and a.delete_type=0 and b.delete_type=0 ) WHERE EXISTS (SELECT 1 FROM hrsa_salary_item_hide b WHERE b.item_hide = a.item_hide);
/
UPDATE hrsa_salary_sob_item_group a SET item_hide = (SELECT b.item_hide FROM hrsa_salary_item_hide b WHERE a.id = b.salary_item_id and a.salary_sob_id = b.salary_sob_id and a.delete_type=0 and b.delete_type=0 ) WHERE EXISTS (SELECT 1 FROM hrsa_salary_item_hide b WHERE b.item_hide = a.item_hide);
/

View File

@ -64,15 +64,6 @@ public class SalarySobItemGroupBiz {
}
}
public List<SalarySobItemGroupPO> listSomeWithItemHide(SalarySobItemGroupPO build) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobItemGroupMapper mapper = sqlSession.getMapper(SalarySobItemGroupMapper.class);
return mapper.listSomeWithItemHide(build);
} finally {
sqlSession.close();
}
}
public void deleteByIds(List<Long> ids) {

View File

@ -0,0 +1,84 @@
package com.engine.salary.entity.salaryacct.bo;
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctSobConfigPO;
import com.engine.salary.entity.salarysob.po.*;
import com.engine.salary.enums.sicategory.DeleteTypeEnum;
import com.engine.salary.util.JsonUtil;
import com.engine.salary.util.db.IdGenerator;
import lombok.Builder;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
@Builder
public class SalaryAcctConfig {
private SalaryAcctRecordPO salaryAcctRecord;
private SalarySobPO salarySob;
private List<SalarySobEmpFieldPO> salarySobEmpFields;
private List<SalarySobItemPO> salarySobItems;
private List<SalarySobItemGroupPO> salarySobItemGroups;
private List<SalarySobBackItemPO> salarySobBackItems;
@Deprecated
private List<SalarySobAdjustRulePO> salarySobAdjustRules;
@Deprecated
private List<SalarySobCheckRulePO> salarySobCheckRules;
public SalaryAcctConfig(SalaryAcctRecordPO salaryAcctRecord,
SalarySobPO salarySob,
List<SalarySobEmpFieldPO> salarySobEmpFields,
List<SalarySobItemPO> salarySobItems,
List<SalarySobItemGroupPO> salarySobItemGroups,
List<SalarySobBackItemPO> salarySobBackItems,
List<SalarySobAdjustRulePO> salarySobAdjustRules,
List<SalarySobCheckRulePO> salarySobCheckRules) {
this.salaryAcctRecord = salaryAcctRecord;
this.salarySob = salarySob;
this.salarySobEmpFields = salarySobEmpFields;
this.salarySobItems = salarySobItems;
this.salarySobItemGroups = salarySobItemGroups;
this.salarySobBackItems = salarySobBackItems;
this.salarySobAdjustRules = salarySobAdjustRules;
this.salarySobCheckRules = salarySobCheckRules;
}
public SalaryAcctSobConfigPO buildAcctSobConfig() {
Date now = new Date();
return SalaryAcctSobConfigPO.builder()
.id(IdGenerator.generate())
.salaryAcctRecordId(salaryAcctRecord.getId())
.basicConfig(JsonUtil.toJsonString(salarySob))
.employeeFieldConfig(JsonUtil.toJsonString(salarySobEmpFields))
.itemConfig(JsonUtil.toJsonString(salarySobItems))
.itemGroupConfig(JsonUtil.toJsonString(salarySobItemGroups))
.backItemConfig(JsonUtil.toJsonString(salarySobBackItems))
.adjustRuleConfig(JsonUtil.toJsonString(salarySobAdjustRules))
.checkRuleConfig(JsonUtil.toJsonString(salarySobCheckRules))
.tenantKey(salaryAcctRecord.getTenantKey())
.deleteType(DeleteTypeEnum.NOT_DELETED.getValue())
.creator(salaryAcctRecord.getCreator())
.createTime(now)
.updateTime(now)
.build();
}
public static SalaryAcctConfig parse(SalaryAcctSobConfigPO po) {
return SalaryAcctConfig.builder()
.salarySob(JsonUtil.parseObject(po.getBasicConfig(), SalarySobPO.class))
.salarySobEmpFields(JsonUtil.parseList(po.getEmployeeFieldConfig(), SalarySobEmpFieldPO.class))
.salarySobItemGroups(JsonUtil.parseList(po.getItemGroupConfig(), SalarySobItemGroupPO.class))
.salarySobItems(JsonUtil.parseList(po.getItemConfig(), SalarySobItemPO.class))
.salarySobBackItems(JsonUtil.parseList(po.getBackItemConfig(), SalarySobBackItemPO.class))
.build();
}
}

View File

@ -0,0 +1,100 @@
package com.engine.salary.entity.salaryacct.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Collection;
import java.util.Date;
/**
* 账套快照
* <p>Copyright: Copyright (c) 2024</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//hrsa_salary_acct_sob_config
public class SalaryAcctSobConfigPO {
/**
* 主键id
*/
private Long id;
/**
* 薪资核算记录id
*/
private Long salaryAcctRecordId;
/**
* 薪资账套基本信息
*/
private String basicConfig;
/**
* 员工信息字段
*/
private String employeeFieldConfig;
/**
* 薪资项目
*/
private String itemConfig;
/**
* 薪资项目分类
*/
private String itemGroupConfig;
/**
* 回算薪资项目
*/
private String backItemConfig;
/**
* 调薪规则
*/
@Deprecated
private String adjustRuleConfig;
/**
* 校验规则
*/
@Deprecated
private String checkRuleConfig;
/**
* 租户key
*/
private String tenantKey;
/**
* 创建人id
*/
private Long creator;
/**
* 是否删除
*/
private Integer deleteType;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
//主键id集合
private Collection<Long> ids;
}

View File

@ -8,9 +8,13 @@ import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import java.util.Collection;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author Harryxzy
@ -116,4 +120,28 @@ public class SalarySobBackItemPO{
* 薪资项目id
*/
private Collection<Long> salaryItemIds;
public String toCompareString() {
return "SalarySobBackItemPO{" +
"salarySobId=" + salarySobId +
", salaryItemId=" + salaryItemId +
", salaryItemCode='" + salaryItemCode + '\'' +
", dataType='" + dataType + '\'' +
", roundingMode=" + roundingMode +
", pattern=" + pattern +
", valueType=" + valueType +
", formulaId=" + formulaId +
", backCalcType=" + backCalcType +
'}';
}
public static String toCompareString(List<SalarySobBackItemPO> salarySobBackItems) {
if (CollectionUtils.isEmpty(salarySobBackItems)) {
return "";
}
return salarySobBackItems.stream()
.sorted(Comparator.comparingLong(SalarySobBackItemPO::getSalaryItemId))
.map(SalarySobBackItemPO::toCompareString)
.collect(Collectors.joining(","));
}
}

View File

@ -5,9 +5,13 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.apache.commons.collections4.CollectionUtils;
import java.util.Collection;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* 薪资账套-薪资项目-员工基本信息
@ -76,4 +80,23 @@ public class SalarySobEmpFieldPO {
private Date updateTime;
Collection<Long> ids;
public String toCompareString() {
return "SalarySobEmpFieldPO{" +
"salarySobId=" + salarySobId +
", fieldCode='" + fieldCode + '\'' +
", sortedIndex=" + sortedIndex +
", canDelete=" + canDelete +
'}';
}
public static String toCompareString(List<SalarySobEmpFieldPO> salarySobEmpFields) {
if (CollectionUtils.isEmpty(salarySobEmpFields)) {
return "";
}
return salarySobEmpFields.stream()
.sorted(Comparator.comparingInt(SalarySobEmpFieldPO::getSortedIndex))
.map(SalarySobEmpFieldPO::toCompareString)
.collect(Collectors.joining(","));
}
}

View File

@ -4,9 +4,13 @@ import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import java.util.Collection;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* 薪资账套薪资项目分组
@ -77,4 +81,22 @@ public class SalarySobItemGroupPO {
private Long itemHide;
Collection<Long> ids;
public String toCompareString() {
return "SalarySobItemGroupPO{" +
"name='" + name + '\'' +
", sortedIndex=" + sortedIndex +
", itemHide=" + itemHide +
'}';
}
public static String toCompareString(List<SalarySobItemGroupPO> salarySobItemGroups) {
if (CollectionUtils.isEmpty(salarySobItemGroups)) {
return "";
}
return salarySobItemGroups.stream()
.sorted(Comparator.comparing(SalarySobItemGroupPO::getSortedIndex))
.map(SalarySobItemGroupPO::toCompareString)
.collect(Collectors.joining(","));
}
}

View File

@ -7,9 +7,13 @@ import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import java.util.Collection;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* 薪资账套薪资项目
@ -124,4 +128,30 @@ public class SalarySobItemPO {
Collection<Long> notInSalaryItemIds;
public String toCompareString() {
return "SalarySobItemPO{" +
"salarySobId=" + salarySobId +
", salaryItemId=" + salaryItemId +
", salarySobItemGroupId=" + salarySobItemGroupId +
", formulaId=" + formulaId +
", sortedIndex=" + sortedIndex +
", canDelete=" + canDelete +
", roundingMode=" + roundingMode +
", pattern=" + pattern +
", valueType=" + valueType +
", itemHide=" + itemHide +
'}';
}
public static String toCompareString(List<SalarySobItemPO> salarySobItems) {
if (CollectionUtils.isEmpty(salarySobItems)) {
return "";
}
return salarySobItems.stream()
.sorted(Comparator.comparingLong(SalarySobItemPO::getSalaryItemId))
.map(SalarySobItemPO::toCompareString)
.collect(Collectors.joining(","));
}
}

View File

@ -1,6 +1,7 @@
package com.engine.salary.entity.salarysob.po;
import com.engine.hrmelog.annotation.ElogTransform;
import com.engine.salary.util.valid.Compare;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -26,12 +27,14 @@ public class SalarySobPO {
* 主键id
*/
@ElogTransform( name="主键" )
@Compare
private Long id;
/**
* 名称
*/
@ElogTransform( name="名称" )
@Compare
private String name;
/**
@ -44,42 +47,49 @@ public class SalarySobPO {
* 应税项目1:正常工资薪金所得
*/
@ElogTransform( name="薪资类型" )
@Compare
private Integer incomeCategory;
/**
* 薪资周期1:上上月2:上月3:本月4:下月
*/
@ElogTransform( name="薪资周期" )
@Compare
private Integer salaryCycleType;
/**
* 薪资周期的起始日期
*/
@ElogTransform( name="薪资周期起始日期" )
@Compare
private Integer salaryCycleFromDay;
/**
* 税款所属期1:上上月2:上月3:本月4:下月
*/
@ElogTransform( name="税款所属期" )
@Compare
private Integer taxCycleType;
/**
* 考勤周期1:上上月2:上月3:本月4:下月
*/
@ElogTransform( name="考勤周期" )
@Compare
private Integer attendCycleType;
/**
* 考勤周期的起始日期
*/
@ElogTransform( name="考勤周期起始日期" )
@Compare
private Integer attendCycleFromDay;
/**
* 社保福利所属期1:上上月2:上月3:本月4:下月
*/
@ElogTransform( name="社保福利所属期" )
@Compare
private Integer socialSecurityCycleType;
/**

View File

@ -0,0 +1,80 @@
package com.engine.salary.mapper.salaryacct;
import com.engine.salary.entity.salaryacct.po.SalaryAcctSobConfigPO;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
public interface SalaryAcctSobConfigMapper {
/**
* 查询所有记录
*
* @return 返回集合没有返回空List
*/
List<SalaryAcctSobConfigPO> listAll();
/**
* 条件查询
*
* @return 返回集合没有返回空List
*/
List<SalaryAcctSobConfigPO> listSome(SalaryAcctSobConfigPO salaryAcctSobConfig);
/**
* 根据核算id查询
* @param salaryAcctRecordId
* @return
*/
SalaryAcctSobConfigPO getBySalaryAcctRecordId(Long salaryAcctRecordId);
/**
* 根据主键查询
*
* @param id 主键
* @return 返回记录没有返回null
*/
SalaryAcctSobConfigPO getById(Long id);
/**
* 新增忽略null字段
*
* @param salaryAcctSobConfig 新增的记录
* @return 返回影响行数
*/
int insertIgnoreNull(SalaryAcctSobConfigPO salaryAcctSobConfig);
/**
* 修改修改所有字段
*
* @param salaryAcctSobConfig 修改的记录
* @return 返回影响行数
*/
int update(SalaryAcctSobConfigPO salaryAcctSobConfig);
/**
* 修改忽略null字段
*
* @param salaryAcctSobConfig 修改的记录
* @return 返回影响行数
*/
int updateIgnoreNull(SalaryAcctSobConfigPO salaryAcctSobConfig);
/**
* 删除记录
*
* @param salaryAcctSobConfig 待删除的记录
* @return 返回影响行数
*/
int delete(SalaryAcctSobConfigPO salaryAcctSobConfig);
/**
* 批量删除记录
* @param ids 主键id集合
*/
void deleteByIds(@Param("ids") Collection<Long> ids);
void deleteBySalaryAcctRecordIds(@Param("salaryAcctRecordIds") Collection<Long> salaryAcctRecordIds);
}

View File

@ -0,0 +1,316 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.engine.salary.mapper.salaryacct.SalaryAcctSobConfigMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.salaryacct.po.SalaryAcctSobConfigPO">
<result column="adjust_rule_config" property="adjustRuleConfig"/>
<result column="back_item_config" property="backItemConfig"/>
<result column="basic_config" property="basicConfig"/>
<result column="check_rule_config" property="checkRuleConfig"/>
<result column="create_time" property="createTime"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="employee_field_config" property="employeeFieldConfig"/>
<result column="id" property="id"/>
<result column="item_config" property="itemConfig"/>
<result column="item_group_config" property="itemGroupConfig"/>
<result column="salary_acct_record_id" property="salaryAcctRecordId"/>
<result column="tenant_key" property="tenantKey"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t
.
adjust_rule_config
, t.back_item_config
, t.basic_config
, t.check_rule_config
, t.create_time
, t.creator
, t.delete_type
, t.employee_field_config
, t.id
, t.item_config
, t.item_group_config
, t.salary_acct_record_id
, t.tenant_key
, t.update_time
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hrsa_salary_acct_sob_config t
WHERE delete_type = 0
</select>
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns"/>
FROM hrsa_salary_acct_sob_config t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
<select id="getBySalaryAcctRecordId" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns"/>
FROM hrsa_salary_acct_sob_config t
WHERE salary_acct_record_id = #{salaryAcctRecordId} AND delete_type = 0
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap"
parameterType="com.engine.salary.entity.salaryacct.po.SalaryAcctSobConfigPO">
SELECT
<include refid="baseColumns"/>
FROM hrsa_salary_acct_sob_config t
WHERE delete_type = 0
<if test="adjustRuleConfig != null">
AND adjust_rule_config = #{adjustRuleConfig}
</if>
<if test="backItemConfig != null">
AND back_item_config = #{backItemConfig}
</if>
<if test="basicConfig != null">
AND basic_config = #{basicConfig}
</if>
<if test="checkRuleConfig != null">
AND check_rule_config = #{checkRuleConfig}
</if>
<if test="createTime != null">
AND create_time = #{createTime}
</if>
<if test="creator != null">
AND creator = #{creator}
</if>
<if test="deleteType != null">
AND delete_type = #{deleteType}
</if>
<if test="employeeFieldConfig != null">
AND employee_field_config = #{employeeFieldConfig}
</if>
<if test="id != null">
AND id = #{id}
</if>
<if test="itemConfig != null">
AND item_config = #{itemConfig}
</if>
<if test="itemGroupConfig != null">
AND item_group_config = #{itemGroupConfig}
</if>
<if test="salaryAcctRecordId != null">
AND salary_acct_record_id = #{salaryAcctRecordId}
</if>
<if test="tenantKey != null">
AND tenant_key = #{tenantKey}
</if>
<if test="updateTime != null">
AND update_time = #{updateTime}
</if>
<if test="ids != null and ids.size()>0">
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
ORDER BY id DESC
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.salaryacct.po.SalaryAcctSobConfigPO">
INSERT INTO hrsa_salary_acct_sob_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="adjustRuleConfig != null">
adjust_rule_config,
</if>
<if test="backItemConfig != null">
back_item_config,
</if>
<if test="basicConfig != null">
basic_config,
</if>
<if test="checkRuleConfig != null">
check_rule_config,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="employeeFieldConfig != null">
employee_field_config,
</if>
<if test="id != null">
id,
</if>
<if test="itemConfig != null">
item_config,
</if>
<if test="itemGroupConfig != null">
item_group_config,
</if>
<if test="salaryAcctRecordId != null">
salary_acct_record_id,
</if>
<if test="tenantKey != null">
tenant_key,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="adjustRuleConfig != null">
#{adjustRuleConfig},
</if>
<if test="backItemConfig != null">
#{backItemConfig},
</if>
<if test="basicConfig != null">
#{basicConfig},
</if>
<if test="checkRuleConfig != null">
#{checkRuleConfig},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="employeeFieldConfig != null">
#{employeeFieldConfig},
</if>
<if test="id != null">
#{id},
</if>
<if test="itemConfig != null">
#{itemConfig},
</if>
<if test="itemGroupConfig != null">
#{itemGroupConfig},
</if>
<if test="salaryAcctRecordId != null">
#{salaryAcctRecordId},
</if>
<if test="tenantKey != null">
#{tenantKey},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
</trim>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.entity.salaryacct.po.SalaryAcctSobConfigPO">
UPDATE hrsa_salary_acct_sob_config
<set>
adjust_rule_config=#{adjustRuleConfig},
back_item_config=#{backItemConfig},
basic_config=#{basicConfig},
check_rule_config=#{checkRuleConfig},
create_time=#{createTime},
creator=#{creator},
delete_type=#{deleteType},
employee_field_config=#{employeeFieldConfig},
item_config=#{itemConfig},
item_group_config=#{itemGroupConfig},
salary_acct_record_id=#{salaryAcctRecordId},
tenant_key=#{tenantKey},
update_time=#{updateTime},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.salaryacct.po.SalaryAcctSobConfigPO">
UPDATE hrsa_salary_acct_sob_config
<set>
<if test="adjustRuleConfig != null">
adjust_rule_config=#{adjustRuleConfig},
</if>
<if test="backItemConfig != null">
back_item_config=#{backItemConfig},
</if>
<if test="basicConfig != null">
basic_config=#{basicConfig},
</if>
<if test="checkRuleConfig != null">
check_rule_config=#{checkRuleConfig},
</if>
<if test="createTime != null">
create_time=#{createTime},
</if>
<if test="creator != null">
creator=#{creator},
</if>
<if test="deleteType != null">
delete_type=#{deleteType},
</if>
<if test="employeeFieldConfig != null">
employee_field_config=#{employeeFieldConfig},
</if>
<if test="itemConfig != null">
item_config=#{itemConfig},
</if>
<if test="itemGroupConfig != null">
item_group_config=#{itemGroupConfig},
</if>
<if test="salaryAcctRecordId != null">
salary_acct_record_id=#{salaryAcctRecordId},
</if>
<if test="tenantKey != null">
tenant_key=#{tenantKey},
</if>
<if test="updateTime != null">
update_time=#{updateTime},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 根据主键删除记录 -->
<delete id="delete">
UPDATE hrsa_salary_acct_sob_config
SET delete_type=1
WHERE id = #{id}
AND delete_type = 0
</delete>
<delete id="deleteByIds">
UPDATE hrsa_salary_acct_sob_config
SET delete_type = 1
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteBySalaryAcctRecordIds">
UPDATE hrsa_salary_acct_sob_config
SET delete_type = 1
WHERE delete_type = 0
AND salary_acct_record_id IN
<foreach collection="salaryAcctRecordIds" open="(" item="salaryAcctRecordId" separator="," close=")">
#{salaryAcctRecordId}
</foreach>
</delete>
</mapper>

View File

@ -22,8 +22,6 @@ public interface SalarySobItemGroupMapper {
*/
List<SalarySobItemGroupPO> listSome(SalarySobItemGroupPO salarySobItemGroup);
List<SalarySobItemGroupPO> listSomeWithItemHide(SalarySobItemGroupPO build);
/**
* 根据主键查询
*

View File

@ -29,6 +29,7 @@
, t.creator
, t.delete_type
, t.tenant_key
, t.item_hide
</sql>
<!-- 查询全部 -->
@ -95,33 +96,6 @@
<select id="listSomeWithItemHide" resultMap="BaseResultMap"
parameterType="com.engine.salary.entity.salarysob.po.SalarySobItemGroupPO">
SELECT
t
.
id
, t.salary_sob_id
, t.name
, t.sorted_index
, t.description
, t.create_time
, t.update_time
, t.creator
, t.delete_type
, t.tenant_key
, h.item_hide
from hrsa_salary_sob_item_group t LEFT JOIN hrsa_salary_item_hide h ON t.id=h.salary_item_id
where t.delete_type=0
<if test="id != null">
AND t.id = #{id}
</if>
<if test="salarySobId != null">
AND t.salary_sob_id = #{salarySobId}
</if>
ORDER BY id DESC
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.salarysob.po.SalarySobItemGroupPO">
@ -158,6 +132,9 @@
<if test="tenantKey != null">
tenant_key,
</if>
<if test="itemHide != null">
item_hide,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -190,6 +167,9 @@
<if test="tenantKey != null">
#{tenantKey},
</if>
<if test="itemHide != null">
#{itemHide},
</if>
</trim>
</insert>
@ -206,6 +186,7 @@
creator=#{creator},
delete_type=#{deleteType},
tenant_key=#{tenantKey},
item_hide=#{itemHide},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
@ -242,6 +223,9 @@
<if test="tenantKey != null">
tenant_key=#{tenantKey},
</if>
<if test="itemHide != null">
item_hide=#{itemHide},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
@ -278,7 +262,7 @@
<insert id="batchInsert">
INSERT INTO hrsa_salary_sob_item_group(id, salary_sob_id, name, sorted_index, description, create_time,
update_time, creator, tenant_key)
update_time, creator, tenant_key,item_hide)
VALUES
<foreach collection="collection" item="item" separator=",">
(
@ -290,13 +274,14 @@
#{item.createTime},
#{item.updateTime},
#{item.creator},
#{item.tenantKey}
#{item.tenantKey},
#{item.itemHide}
)
</foreach>
</insert>
<insert id="batchInsert" databaseId="oracle">
INSERT INTO hrsa_salary_sob_item_group(id, salary_sob_id, name, sorted_index, description, create_time,
update_time, creator, tenant_key)
update_time, creator, tenant_key,item_hide)
<foreach collection="collection" item="item" separator="union all">
select
@ -308,14 +293,15 @@
#{item.createTime,jdbcType=DATE},
#{item.updateTime,jdbcType=DATE},
#{item.creator,jdbcType=DOUBLE},
#{item.tenantKey,jdbcType=VARCHAR}
#{item.tenantKey,jdbcType=VARCHAR},
#{item.itemHide,jdbcType=VARCHAR}
from dual
</foreach>
</insert>
<insert id="batchInsert" databaseId="sqlserver">
<foreach collection="collection" item="item" separator=";">
INSERT INTO hrsa_salary_sob_item_group(id, salary_sob_id, name, sorted_index, description, create_time,
update_time, creator, tenant_key)
update_time, creator, tenant_key,item_hide)
VALUES
(
#{item.id},
@ -326,7 +312,8 @@
#{item.createTime},
#{item.updateTime},
#{item.creator},
#{item.tenantKey}
#{item.tenantKey},
#{item.itemHide}
)
</foreach>
</insert>

View File

@ -15,6 +15,7 @@
<result column="tenant_key" property="tenantKey"/>
<result column="update_time" property="updateTime"/>
<result column="can_delete" property="canDelete"/>
<result column="item_hide" property="itemHide"/>
</resultMap>
<!-- 表字段 -->
@ -37,6 +38,7 @@
, t.rounding_mode
, t.pattern
, t.value_type
, t.item_hide
</sql>
<!-- 查询全部 -->
@ -219,6 +221,9 @@
<if test="canDelete != null">
can_delete,
</if>
<if test="itemHide != null">
item_hide,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="createTime != null">
@ -258,7 +263,10 @@
#{updateTime},
</if>
<if test="canDelete != null">
can_delete,
#{canDelete},
</if>
<if test="itemHide != null">
#{itemHide},
</if>
</trim>
</insert>
@ -282,6 +290,7 @@
rounding_mode=#{roundingMode},
pattern=#{pattern},
value_type=#{valueType},
item_hide=#{itemHide},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
@ -336,6 +345,9 @@
<if test="valueType != null">
value_type=#{valueType},
</if>
<if test="itemHide != null">
item_hide=#{itemHide},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
@ -382,7 +394,7 @@
<insert id="batchInsert">
INSERT INTO hrsa_salary_sob_item(salary_sob_id, salary_item_id, salary_sob_item_group_id, formula_id,
sorted_index, description, create_time, update_time, creator, delete_type, tenant_key,can_delete,rounding_mode,pattern,value_type)
sorted_index, description, create_time, update_time, creator, delete_type, tenant_key,can_delete,rounding_mode,pattern,value_type,item_hide)
VALUES
<foreach collection="collection" item="item" separator=",">
(
@ -400,13 +412,14 @@
#{item.canDelete},
#{item.roundingMode},
#{item.pattern},
#{item.valueType}
#{item.valueType},
#{item.itemHide}
)
</foreach>
</insert>
<insert id="batchInsert" databaseId="oracle">
INSERT INTO hrsa_salary_sob_item( salary_sob_id, salary_item_id, salary_sob_item_group_id, formula_id,
sorted_index, description, create_time, update_time, creator, delete_type, tenant_key,can_delete,rounding_mode,pattern,value_type)
sorted_index, description, create_time, update_time, creator, delete_type, tenant_key,can_delete,rounding_mode,pattern,value_type,item_hide)
<foreach collection="collection" item="item" separator="union all">
select
@ -424,14 +437,15 @@
#{item.canDelete,jdbcType=INTEGER},
#{item.roundingMode,jdbcType=INTEGER},
#{item.pattern,jdbcType=INTEGER},
#{item.valueType,jdbcType=INTEGER}
#{item.valueType,jdbcType=INTEGER},
#{item.itemHide,jdbcType=DOUBLE}
from dual
</foreach>
</insert>
<insert id="batchInsert" databaseId="sqlserver">
<foreach collection="collection" item="item" separator=";">
INSERT INTO hrsa_salary_sob_item( salary_sob_id, salary_item_id, salary_sob_item_group_id, formula_id,
sorted_index, description, create_time, update_time, creator, delete_type, tenant_key,can_delete,rounding_mode,pattern,value_type)
sorted_index, description, create_time, update_time, creator, delete_type, tenant_key,can_delete,rounding_mode,pattern,value_type,item_hide)
VALUES
(
#{item.salarySobId},
@ -448,7 +462,8 @@
#{item.canDelete},
#{item.roundingMode},
#{item.pattern},
#{item.valueType}
#{item.valueType},
#{item.itemHide}
)
</foreach>
</insert>

View File

@ -0,0 +1,86 @@
package com.engine.salary.service;
import com.engine.salary.entity.salaryacct.bo.SalaryAcctConfig;
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctSobConfigPO;
import com.engine.salary.entity.salarysob.dto.SalarySobItemAggregateDTO;
import java.util.Collection;
/**
* 薪资核算的账套副本配置
* <p>Copyright: Copyright (c) 2024</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public interface SalaryAcctSobConfigService{
/**
* 根据薪资核算记录id查询薪资核算的账套配置
*
* @param salaryAcctRecordId
* @return
*/
SalaryAcctSobConfigPO getBySalaryAcctRecordId(Long salaryAcctRecordId);
/**
* 获取账套快照
* @param salaryAcctRecordId
* @return
*/
SalaryAcctConfig getSalaryAcctConfig(Long salaryAcctRecordId);
/**
* 根据薪资核算记录id查询薪资核算的账套配置
*
* @param needInit 倘若当前薪资核算还没有保存账套配置是否需要初始化一个此处初始化不会入库
* @param salaryAcctRecordId
* @return
*/
SalaryAcctSobConfigPO getBySalaryAcctRecordId(boolean needInit, Long salaryAcctRecordId);
/**
* 薪资核算的账套配置转换成薪资账套的聚合对象
*
* @param salaryAcctRecordId
* @return
*/
SalarySobItemAggregateDTO getSalarySobItemAggregate(Long salaryAcctRecordId);
/**
* 薪资核算的账套配置转换成薪资账套的聚合对象
*
* @param salaryAcctRecordId
* @return
*/
SalarySobItemAggregateDTO getSalarySobItemAggregateNoFormula(Long salaryAcctRecordId);
/**
* 初始化薪资核算的账套配置
*
* @param salaryAcctRecord
*/
SalaryAcctSobConfigPO initBySalaryAcctRecord(SalaryAcctRecordPO salaryAcctRecord);
/**
*
* @param salaryAcctSobConfig
*/
void save(SalaryAcctSobConfigPO salaryAcctSobConfig);
/**
* 更新薪资核算的账套配置
*
* @param salaryAcctRecordId
*/
void updateBySalaryAcctRecordId(Long salaryAcctRecordId);
/**
* 删除薪资核算的账套配置
*
* @param salaryAcctRecordIds
*/
void deleteBySalaryAcctRecordIds(Collection<Long> salaryAcctRecordIds);
}

View File

@ -31,14 +31,6 @@ public interface SalarySobItemGroupService {
*/
List<SalarySobItemGroupPO> listBySalarySobId(Long salarySobId);
/**
* 根据薪资账套id查询薪资账套的薪资项目分类带上隐藏信息
*
* @param salarySobId 薪资账套id
* @return
*/
List<SalarySobItemGroupPO> listBySalarySobIdWithItemHide(Long salarySobId);
/**
* 批量保存
*

View File

@ -33,14 +33,6 @@ public interface SalarySobItemService {
*/
List<SalarySobItemPO> listBySalarySobId(Long salarySobId);
/**
* 根据薪资账套id查询薪资账套的薪资项目副本(不包括已隐藏的薪资项目列)
*
* @param salarySobId 薪资账套的id
* @return
*/
List<SalarySobItemPO> listBySalarySobIdWithHideItem(Long salarySobId);
/**
* 根据薪资账套id和薪资项目分类查询薪资账套的薪资项目副本
*
@ -93,7 +85,7 @@ public interface SalarySobItemService {
* @param salarySobId
* @return
*/
SalarySobItemAggregateDTO getAggregateWithItemHideBySalarySobId(Long salarySobId, boolean isBackCalc);
SalarySobItemAggregateDTO getAggregateWithItemHideBySalarySobId(Long salaryAcctRecordId,Long salarySobId, boolean isBackCalc);
/**
* 保存

View File

@ -12,6 +12,7 @@ import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.constant.SalaryItemConstant;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.report.po.SalaryAcctResultReportPO;
import com.engine.salary.entity.salaryacct.bo.SalaryAcctConfig;
import com.engine.salary.entity.salaryacct.bo.SalaryAcctEmployeeBO;
import com.engine.salary.entity.salaryacct.bo.SalaryAcctResultBO;
import com.engine.salary.entity.salaryacct.bo.SalaryAcctResultLogBO;
@ -158,13 +159,17 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
return ServiceUtil.getService(SalaryAcctResultTemplateServiceImpl.class, user);
}
private SalaryAcctSobConfigService getSalaryAcctSobConfigService(User user) {
return ServiceUtil.getService(SalaryAcctSobConfigServiceImpl.class, user);
}
@Override
public XSSFWorkbook exportSalaryAcctEmployee(SalaryAcctEmployeeQueryParam queryParam) {
ValidUtil.doValidator(queryParam);
SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(queryParam.getSalaryAcctRecordId());
if (salaryAcctRecordPO == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"薪资核算记录不存在或已被删除"));
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "薪资核算记录不存在或已被删除"));
}
// 1.工作簿名称
String sheetName = SalaryI18nUtil.getI18nLabel(85368, "核算人员范围");
@ -431,7 +436,7 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
SalaryI18nUtil.getI18nLabel(0, "导出薪资核算结果"),
SalaryI18nUtil.getI18nLabel(0, "导出薪资核算结果") + ":" + targetName,
user
);
);
String sheetName = "薪资核算结果";
@ -451,7 +456,7 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
SalaryAcctRecordPO byId = getSalaryAcctRecordService(user).getById(salaryAcctRecordPO.getId());
boolean isBackCalc = Objects.equals(byId.getBackCalcStatus(), 1);
// 查询薪资账套下的薪资项目+员工信息字段
SalarySobItemAggregateDTO salarySobItemAggregateDTO = getSalarySobItemService(user).getAggregateWithItemHideBySalarySobId(salaryAcctRecordPO.getSalarySobId(), isBackCalc);
SalarySobItemAggregateDTO salarySobItemAggregateDTO = getSalarySobItemService(user).getAggregateWithItemHideBySalarySobId(salaryAcctRecordPO.getId(),salaryAcctRecordPO.getSalarySobId(), isBackCalc);
// 构建薪资核算结果列表表头
List<WeaTableColumnGroup> columnList = SalaryAcctResultBO.buildTableColumns(salarySobItemAggregateDTO, ListUtils.emptyIfNull(salaryAcctRecordPO.getLockSalaryItemIds()));
// 获取固定列头数
@ -504,8 +509,11 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
if (Objects.isNull(salaryAcctRecordPO)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98747, "薪资核算记录不存在或已被删除"));
}
SalaryAcctConfig config = getSalaryAcctSobConfigService(user).getSalaryAcctConfig(salaryAcctRecordId);
// 查询薪资核算记录所用的薪资账套的薪资项目副本
List<SalarySobItemPO> salarySobItems = getSalarySobItemService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
List<SalarySobItemPO> salarySobItems = config.getSalarySobItems();
Set<Long> salaryItemIds = SalaryEntityUtil.properties(salarySobItems, SalarySobItemPO::getSalaryItemId);
// 查询薪资项目
List<SalaryItemPO> salaryItems = getSalaryItemService(user).listByIds(salaryItemIds);
@ -514,7 +522,7 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
Map<Long, List<SalarySobItemPO>> salarySobItemPOMap = SalaryEntityUtil.group2Map(salarySobItems, SalarySobItemPO::getSalarySobItemGroupId);
// 查询薪资账套的薪资项目分类
List<SalarySobItemGroupPO> salarySobItemGroupPOS = getSalarySobItemGroupService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
List<SalarySobItemGroupPO> salarySobItemGroupPOS = config.getSalarySobItemGroups();
// 对分组进行排序
salarySobItemGroupPOS = SalaryAcctResultBO.sortGroup(salarySobItemGroupPOS);
// 对分组内薪资项目排序
@ -595,8 +603,10 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
if (Objects.isNull(salaryAcctRecordPO)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98747, "薪资核算记录不存在或已被删除"));
}
SalaryAcctConfig salaryAcctConfig = getSalaryAcctSobConfigService(user).getSalaryAcctConfig(salaryAcctRecordId);
// 查询薪资核算记录所用的薪资账套的薪资项目副本
List<SalarySobItemPO> salarySobItems = getSalarySobItemService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
List<SalarySobItemPO> salarySobItems = salaryAcctConfig.getSalarySobItems();
Set<Long> salaryItemIds = SalaryEntityUtil.properties(salarySobItems, SalarySobItemPO::getSalaryItemId);
// 查询薪资项目
List<SalaryItemPO> salaryItems = getSalaryItemService(user).listByIds(salaryItemIds);
@ -605,7 +615,7 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
Map<Long, List<SalarySobItemPO>> salarySobItemPOMap = SalaryEntityUtil.group2Map(salarySobItems, SalarySobItemPO::getSalarySobItemGroupId);
// 查询薪资账套的薪资项目分类
List<SalarySobItemGroupPO> salarySobItemGroupPOS = getSalarySobItemGroupService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
List<SalarySobItemGroupPO> salarySobItemGroupPOS = salaryAcctConfig.getSalarySobItemGroups();
// 对分组进行排序
salarySobItemGroupPOS = SalaryAcctResultBO.sortGroup(salarySobItemGroupPOS);
// 对分组内薪资项目排序
@ -1352,7 +1362,7 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
List<SalaryAcctResultPO> list4log = new ArrayList<>();
salaryAcctResults.stream().forEach(source -> {
SalaryAcctResultPO target = new SalaryAcctResultPO();
BeanUtils.copyProperties(source,target);
BeanUtils.copyProperties(source, target);
list4log.add(target);
});
getSalaryAcctResultService(user).batchSave(salaryAcctResults);
@ -1365,8 +1375,8 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
loggerContext.setTargetId(param.getSalaryAcctRecordId().toString());
loggerContext.setTargetName(targetName);
loggerContext.setOperateType(OperateTypeEnum.EXCEL_IMPORT.getValue());
loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel( 0, "导入薪资核算数据"));
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel( 0, "导入薪资核算数据 ") + targetName);
loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "导入薪资核算数据"));
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "导入薪资核算数据 ") + targetName);
loggerContext.setOldValueList(list4log);
SalaryElogConfig.salaryAcctRecordLoggerTemplate.write(loggerContext);
@ -1442,6 +1452,7 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
/**
* 保存导出模板
*
* @param saveParam
*/
@Override
@ -1508,7 +1519,7 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
@Override
public Map<String, Object> exportTemplateList(SalaryAcctResultTemplateSaveParam param) {
SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(param.getSalaryAcctRecordId());
if (salaryAcctRecordPO == null){
if (salaryAcctRecordPO == null) {
throw new SalaryRunTimeException("薪资核算记录为空");
}
List<SalaryAcctResultTemplatePO> salaryAcctResultTemplatePOS = getSalaryAcctResultTemplateService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());

View File

@ -188,9 +188,10 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
return ServiceUtil.getService(TaxAgentAdminServiceImpl.class, user);
}
private SalaryCheckResultService salaryCheckResultService;
private SalaryAcctSobConfigService getSalaryAcctSobConfigService(User user) {
return ServiceUtil.getService(SalaryAcctSobConfigServiceImpl.class, user);
}
@Override
public List<SalaryAcctResultPO> listBySalaryAcctRecordIds(Collection<Long> salaryAcctRecordIds) {
if (CollectionUtils.isEmpty(salaryAcctRecordIds)) {
@ -251,7 +252,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
//----------------------------------------------
// 查询薪资账套的薪资项目分类
List<SalarySobItemGroupPO> salarySobItemGroupPOS = getSalarySobItemGroupService(user).listBySalarySobIdWithItemHide(salaryAcctEmployeePO.getSalarySobId());
List<SalarySobItemGroupPO> salarySobItemGroupPOS = getSalarySobItemGroupService(user).listBySalarySobId(salaryAcctEmployeePO.getSalarySobId());
// 获取关闭显示的分类
List<Long> hideGroupIDs = getSalarySobItemHideService(user).listHideGroupBysalarySobId(SalarySobItemHidePO.builder().salarySobId(salaryAcctEmployeePO.getSalarySobId()).isGroup(1).build());
// 过滤关闭显示的薪资项目分类
@ -436,10 +437,13 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98747, "薪资核算记录不存在或已被删除"));
}
boolean isBackCalc = Objects.equals(salaryAcctRecordPO.getBackCalcStatus(), 1);
SalaryAcctConfig salaryAcctConfig = getSalaryAcctSobConfigService(user).getSalaryAcctConfig(queryParam.getSalaryAcctRecordId());
// 查询薪资核算所用的薪资账套的员工信息字段
List<SalarySobEmpFieldPO> salarySobEmpFieldPOS = getSalarySobEmpFieldService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
List<SalarySobEmpFieldPO> salarySobEmpFieldPOS = salaryAcctConfig.getSalarySobEmpFields();
// 查询薪资核算所用薪资账套的薪资项目
List<SalarySobItemPO> salarySobItemPOS = getSalarySobItemService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
List<SalarySobItemPO> salarySobItemPOS = salaryAcctConfig.getSalarySobItems();
Set<Long> salaryItemIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getSalaryItemId);
// 是否是回算
List<SalarySobBackItemPO> salarySobBackItemPOList = Collections.emptyList();
@ -734,6 +738,10 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
if (Objects.isNull(salarySobPO)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98747, "薪资账套不存在或已被删除"));
}
// 不是查询薪资账套下实时的薪资项目而是查询发起薪资核算时存储的薪资项目快照
SalaryAcctConfig salaryAcctSobConfig = getSalaryAcctSobConfigService(user).getSalaryAcctConfig(calculateParam.getSalaryAcctRecordId());
// 1.1如果薪资核算记录已经归档了就不能继续核算
if (!Objects.equals(salaryAcctRecordPO.getStatus(), SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue())) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(99148, "当前薪资核算记录已归档,请重新打开后再进行核算"));
@ -741,14 +749,14 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
// 2查询薪资核算记录的薪资周期考勤周期等
SalarySobCycleDTO salarySobCycleDTO = getSalaryAcctRecordService(user).getSalarySobCycleById(calculateParam.getSalaryAcctRecordId());
// 3查询薪资核算记录所用薪资账套的薪资项目副本
List<SalarySobItemPO> salarySobItemPOS = getSalarySobItemService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
List<SalarySobItemPO> salarySobItemPOS = salaryAcctSobConfig.getSalarySobItems();
if (CollectionUtils.isEmpty(salarySobItemPOS)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(99151, "当前所用的薪资账套未选择任何薪资项目,无法核算"));
}
// 回算薪资项目
List<SalarySobBackItemPO> salarySobBackItems = Collections.emptyList();
if (Objects.equals(salaryAcctRecordPO.getBackCalcStatus(), 1)) {
salarySobBackItems = getSalarySobBackItemService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
salarySobBackItems = salaryAcctSobConfig.getSalarySobBackItems();
}
// 4查询当前租户的所有薪资项目
List<SalaryItemPO> salaryItemPOS = getSalaryItemService(user).listAll();

View File

@ -0,0 +1,188 @@
package com.engine.salary.service.impl;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.cache.SalaryCacheKey;
import com.engine.salary.entity.salaryacct.bo.SalaryAcctConfig;
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctSobConfigPO;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.bo.SalarySobItemAggregateBO;
import com.engine.salary.entity.salarysob.dto.SalarySobItemAggregateDTO;
import com.engine.salary.entity.salarysob.po.*;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.salaryacct.SalaryAcctSobConfigMapper;
import com.engine.salary.service.*;
import com.engine.salary.util.JsonUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import weaver.hrm.User;
import java.util.*;
/**
* 薪资核算的账套副本配置
* <p>Copyright: Copyright (c) 2024</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalaryAcctSobConfigServiceImpl extends Service implements SalaryAcctSobConfigService {
private SalaryAcctSobConfigMapper getSalaryAcctSobConfigMapper() {
return MapperProxyFactory.getProxy(SalaryAcctSobConfigMapper.class);
}
private SalaryFormulaService getSalaryFormulaService(User user) {
return ServiceUtil.getService(SalaryFormulaServiceImpl.class, user);
}
private SalaryItemService getSalaryItemService(User user) {
return ServiceUtil.getService(SalaryItemServiceImpl.class, user);
}
private SalaryAcctRecordService getSalaryAcctRecordService(User user) {
return ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user);
}
private SalarySobService getSalarySobService(User user) {
return ServiceUtil.getService(SalarySobServiceImpl.class, user);
}
private SalarySobEmpFieldService getSalarySobEmpFieldService(User user) {
return ServiceUtil.getService(SalarySobEmpFieldServiceImpl.class, user);
}
private SalarySobItemGroupService getSalarySobItemGroupService(User user) {
return ServiceUtil.getService(SalarySobItemGroupServiceImpl.class, user);
}
private SalarySobItemService getSalarySobItemService(User user) {
return ServiceUtil.getService(SalarySobItemServiceImpl.class, user);
}
private SalarySobBackItemService getSalarySobBackItemService(User user) {
return ServiceUtil.getService(SalarySobBackItemServiceImpl.class, user);
}
private SalarySobAdjustRuleService getSalarySobAdjustRuleService(User user) {
return ServiceUtil.getService(SalarySobAdjustRuleServiceImpl.class, user);
}
private SalarySobCheckRuleService salarySobCheckRuleService;
private SalaryCacheService getSalaryCacheService(User user) {
return ServiceUtil.getService(SalaryCacheServiceImpl.class, user);
}
@Override
public SalaryAcctSobConfigPO getBySalaryAcctRecordId(Long salaryAcctRecordId) {
return getBySalaryAcctRecordId(true, salaryAcctRecordId);
}
@Override
public SalaryAcctConfig getSalaryAcctConfig(Long salaryAcctRecordId) {
SalaryAcctSobConfigPO po = getBySalaryAcctRecordId(true, salaryAcctRecordId);
return SalaryAcctConfig.parse(po);
}
@Override
public SalaryAcctSobConfigPO getBySalaryAcctRecordId(boolean needInit, Long salaryAcctRecordId) {
SalaryAcctSobConfigPO salaryAcctSobConfig = getSalaryAcctSobConfigMapper().getBySalaryAcctRecordId(salaryAcctRecordId);
if (Objects.nonNull(salaryAcctSobConfig)) {
return salaryAcctSobConfig;
}
// 查询薪资核算记录
SalaryAcctRecordPO salaryAcctRecord = getSalaryAcctRecordService(user).getById(salaryAcctRecordId);
// 初始化薪资核算记录的列配置
if (needInit) {
salaryAcctSobConfig = initBySalaryAcctRecord(salaryAcctRecord);
}
return salaryAcctSobConfig;
}
@Override
public SalarySobItemAggregateDTO getSalarySobItemAggregate(Long salaryAcctRecordId) {
return getSalarySobItemAggregate(true, salaryAcctRecordId);
}
@Override
public SalarySobItemAggregateDTO getSalarySobItemAggregateNoFormula(Long salaryAcctRecordId) {
return getSalarySobItemAggregate(false, salaryAcctRecordId);
}
private SalarySobItemAggregateDTO getSalarySobItemAggregate(boolean needFormula, Long salaryAcctRecordId) {
// 查询薪资核算
SalaryAcctSobConfigPO salaryAcctSobConfig = getBySalaryAcctRecordId(salaryAcctRecordId);
// 薪资账套的基本信息
SalarySobPO salarySob = JsonUtil.parseObject(salaryAcctSobConfig.getBasicConfig(), SalarySobPO.class);
// 员工信息字段
List<SalarySobEmpFieldPO> salarySobEmpFields = JsonUtil.parseList(salaryAcctSobConfig.getEmployeeFieldConfig(), SalarySobEmpFieldPO.class);
// 薪资项目分类
List<SalarySobItemGroupPO> salarySobItemGroups = JsonUtil.parseList(salaryAcctSobConfig.getItemGroupConfig(), SalarySobItemGroupPO.class);
// 薪资项目
List<SalarySobItemPO> salarySobItems = JsonUtil.parseList(salaryAcctSobConfig.getItemConfig(), SalarySobItemPO.class);
// 回算薪资项目
List<SalarySobBackItemPO> salarySobBackItems = JsonUtil.parseList(salaryAcctSobConfig.getBackItemConfig(), SalarySobBackItemPO.class);
// 查询薪资账套的薪资项目所关联的薪资项目
Set<Long> salaryItemIds = SalaryEntityUtil.properties(salarySobItems, SalarySobItemPO::getSalaryItemId);
salaryItemIds.addAll(SalaryEntityUtil.properties(salarySobBackItems, SalarySobBackItemPO::getSalaryItemId));
List<SalaryItemPO> salaryItems = getSalaryItemService(user).listByIds(salaryItemIds);
// 函数公式
List<ExpressFormula> expressFormulas = Collections.emptyList();
if (needFormula) {
Set<Long> formulaIds = SalaryEntityUtil.properties(salarySobItems, SalarySobItemPO::getFormulaId);
formulaIds.addAll(SalaryEntityUtil.properties(salarySobBackItems, SalarySobBackItemPO::getFormulaId));
expressFormulas = getSalaryFormulaService(user).listExpressFormula(formulaIds);
}
// 转换成聚合dto
SalarySobItemAggregateBO salarySobItemAggregateBO = new SalarySobItemAggregateBO(salarySob, salarySobEmpFields,
salarySobItemGroups, salarySobItems, expressFormulas, salaryItems, salarySobBackItems, Collections.emptyList());
return salarySobItemAggregateBO.convert2AggregateDTO();
}
@Override
public SalaryAcctSobConfigPO initBySalaryAcctRecord(SalaryAcctRecordPO salaryAcctRecord) {
// 薪资账套的基本信息
SalarySobPO salarySob = getSalarySobService(user).getById(salaryAcctRecord.getSalarySobId());
// 薪资账套的员工信息字段
List<SalarySobEmpFieldPO> salarySobEmpFields = getSalarySobEmpFieldService(user).listBySalarySobId(salaryAcctRecord.getSalarySobId());
// 薪资账套的薪资项目分类
List<SalarySobItemGroupPO> salarySobItemGroups = getSalarySobItemGroupService(user).listBySalarySobId(salaryAcctRecord.getSalarySobId());
// 薪资账套的薪资项目
List<SalarySobItemPO> salarySobItems = getSalarySobItemService(user).listBySalarySobId(salaryAcctRecord.getSalarySobId());
// 薪资账套的回算薪资项目
List<SalarySobBackItemPO> salarySobBackItemPOS = getSalarySobBackItemService(user).listBySalarySobId(salaryAcctRecord.getSalarySobId());
SalaryAcctConfig salaryAcctConfig = new SalaryAcctConfig(salaryAcctRecord, salarySob, salarySobEmpFields,
salarySobItems, salarySobItemGroups, salarySobBackItemPOS, Collections.emptyList(), Collections.emptyList());
return salaryAcctConfig.buildAcctSobConfig();
}
@Override
public void save(SalaryAcctSobConfigPO salaryAcctSobConfig) {
deleteBySalaryAcctRecordIds(Collections.singleton(salaryAcctSobConfig.getSalaryAcctRecordId()));
getSalaryAcctSobConfigMapper().insertIgnoreNull(salaryAcctSobConfig);
String cacheIndex = salaryAcctSobConfig.getSalaryAcctRecordId().toString();
getSalaryCacheService(user).set(SalaryCacheKey.ACCT_SOB_CONFIG + cacheIndex, "FALSE");
}
@Override
public void updateBySalaryAcctRecordId(Long salaryAcctRecordId) {
SalaryAcctRecordPO salaryAcctRecord = getSalaryAcctRecordService(user).getById(salaryAcctRecordId);
if (salaryAcctRecord == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(156474, "参数错误,薪资核算记录不存在或已被删除"));
}
SalaryAcctSobConfigPO salaryAcctSobConfig = initBySalaryAcctRecord(salaryAcctRecord);
deleteBySalaryAcctRecordIds(Collections.singleton(salaryAcctRecordId));
getSalaryAcctSobConfigMapper().insertIgnoreNull(salaryAcctSobConfig);
}
@Override
public void deleteBySalaryAcctRecordIds(Collection<Long> salaryAcctRecordIds) {
getSalaryAcctSobConfigMapper().deleteBySalaryAcctRecordIds(salaryAcctRecordIds);
}
}

View File

@ -5,6 +5,7 @@ import com.engine.core.impl.Service;
import com.engine.salary.component.WeaTableColumnGroup;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryacct.bo.SalaryAcctConfig;
import com.engine.salary.entity.salaryacct.bo.SalaryAcctResultBO;
import com.engine.salary.entity.salaryacct.dto.SalaryComparisonResultListDTO;
import com.engine.salary.entity.salaryacct.param.SalaryAcctEmployeeQueryParam;
@ -101,6 +102,10 @@ public class SalaryComparisonResultServiceImpl extends Service implements Salary
return ServiceUtil.getService(SalarySobItemHideServiceImpl.class, user);
}
private SalaryAcctSobConfigService getSalaryAcctSobConfigService(User user) {
return ServiceUtil.getService(SalaryAcctSobConfigServiceImpl.class, user);
}
@Override
public List<ExcelAcctResultPO> listBySalaryAcctRecordId(Long salaryAcctRecordId) {
List<ExcelAcctResultPO> excelAcctResultPOS = getExcelAcctResultMapper().listSome(ExcelAcctResultPO.builder().salaryAcctRecordId(salaryAcctRecordId).build());
@ -143,18 +148,19 @@ public class SalaryComparisonResultServiceImpl extends Service implements Salary
if (Objects.isNull(salaryAcctRecordPO)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98747, "薪资核算记录不存在或已被删除"));
}
SalaryAcctConfig salaryAcctConfig = getSalaryAcctSobConfigService(user).getSalaryAcctConfig(queryParam.getSalaryAcctRecordId());
// 查询薪资核算所用薪资账套
SalarySobPO salarySobPO = getSalarySobService(user).getById(salaryAcctRecordPO.getSalarySobId());
// 查询薪资核算所用的薪资账套的员工信息字段
List<SalarySobEmpFieldPO> salarySobEmpFieldPOS = getSalarySobEmpFieldService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
List<SalarySobEmpFieldPO> salarySobEmpFieldPOS = salaryAcctConfig.getSalarySobEmpFields();
// 查询薪资账套的薪资项目分类
List<SalarySobItemGroupPO> salarySobItemGroupPOS = getSalarySobItemGroupService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
List<SalarySobItemGroupPO> salarySobItemGroupPOS = salaryAcctConfig.getSalarySobItemGroups();
// 查询薪资核算所用薪资账套的薪资项目副本
List<SalarySobItemPO> salarySobItemPOS = getSalarySobItemService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
List<SalarySobItemPO> salarySobItemPOS = salaryAcctConfig.getSalarySobItems();
// 过滤在账套中隐藏的薪资项目
List<Long> hideItemIds = getSalarySobItemHideService(user).listSome(SalarySobItemHidePO.builder().itemHide(1L).salarySobId(salaryAcctRecordPO.getSalarySobId()).build())
.stream().map(SalarySobItemHidePO::getSalaryItemId).collect(Collectors.toList());
salarySobItemPOS = salarySobItemPOS.stream().filter(po -> !hideItemIds.contains(po.getSalaryItemId())).collect(Collectors.toList());
salarySobItemPOS = salarySobItemPOS.stream().filter(po -> po.getItemHide()==null || po.getItemHide() == 0).collect(Collectors.toList());
// 查询公式详情
Set<Long> formulaIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getFormulaId);
List<ExpressFormula> expressFormulas = getSalaryFormulaService(user).listExpressFormula(formulaIds);

View File

@ -30,11 +30,6 @@ public class SalarySobItemGroupServiceImpl extends Service implements SalarySobI
return salarySobItemGroupMapper.listSome(SalarySobItemGroupPO.builder().salarySobId(salarySobId).build());
}
@Override
public List<SalarySobItemGroupPO> listBySalarySobIdWithItemHide(Long salarySobId) {
return salarySobItemGroupMapper.listSomeWithItemHide(SalarySobItemGroupPO.builder().salarySobId(salarySobId).build());
}
@Override
public void batchSave(Collection<SalarySobItemGroupPO> salarySobItemGroupPOS) {
salarySobItemGroupMapper.batchInsert(salarySobItemGroupPOS);

View File

@ -9,6 +9,7 @@ import com.engine.salary.biz.SalarySobItemHideBiz;
import com.engine.salary.config.SalaryElogConfig;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.entity.salaryacct.bo.SalaryAcctConfig;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.bo.SalarySobItemAggregateBO;
@ -97,6 +98,10 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
return MapperProxyFactory.getProxy(SalarySobDefaultItemMapper.class);
}
private SalaryAcctSobConfigService getSalaryAcctSobConfigService(User user) {
return ServiceUtil.getService(SalaryAcctSobConfigServiceImpl.class, user);
}
@Override
public List<SalarySobItemPO> list() {
return salarySobItemMapper.listAll();
@ -107,11 +112,6 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
return salarySobItemMapper.listSome(SalarySobItemPO.builder().salarySobId(salarySobId).build());
}
@Override
public List<SalarySobItemPO> listBySalarySobIdWithHideItem(Long salarySobId) {
return salarySobItemMapper.listBySalarySobIdWithHideItem(SalarySobItemPO.builder().salarySobId(salarySobId).build());
}
@Override
public List<SalarySobItemPO> listBySalarySobIdAndGroupId(Long salarySobId, Collection<Long> salarySobItemGroupIds) {
return salarySobItemMapper.listBySalarySobIdAndGroupId(salarySobId, salarySobItemGroupIds);
@ -157,9 +157,9 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
// 查询薪资账套的员工信息字段
List<SalarySobEmpFieldPO> salarySobEmpFieldPOS = getSalarySobEmpFieldService(user).listBySalarySobId(salarySobId);
// 查询薪资账套的薪资项目分类
List<SalarySobItemGroupPO> salarySobItemGroupPOS = getSalarySobItemGroupService(user).listBySalarySobIdWithItemHide(salarySobId);
List<SalarySobItemGroupPO> salarySobItemGroupPOS = getSalarySobItemGroupService(user).listBySalarySobId(salarySobId);
// 查询薪资账套的薪资项目副本
List<SalarySobItemPO> salarySobItemPOS = listBySalarySobIdWithHideItem(salarySobId);
List<SalarySobItemPO> salarySobItemPOS = listBySalarySobId(salarySobId);
// 薪资项目副本去重
salarySobItemPOS = salarySobItemPOS.stream().filter(SalaryEntityUtil.distinctByKey(PO -> PO.getSalarySobId() + "-" + PO.getSalaryItemId())).collect(Collectors.toList());
// 回算薪资项目
@ -197,36 +197,30 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
@Override
public SalarySobItemAggregateDTO getAggregateWithItemHideBySalarySobId(Long salarySobId, boolean isBackCalc) {
public SalarySobItemAggregateDTO getAggregateWithItemHideBySalarySobId(Long salaryAcctRecordId, Long salarySobId, boolean isBackCalc) {
SalaryAcctConfig salaryAcctConfig = getSalaryAcctSobConfigService(user).getSalaryAcctConfig(salaryAcctRecordId);
// 查询薪资账套
SalarySobPO salarySobPO = salarySobBiz.getById(salarySobId);
SalarySobPO salarySobPO = salaryAcctConfig.getSalarySob();
if (Objects.isNull(salarySobPO)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98379, "参数错误,薪资账套不存在或者已被删除"));
}
// 查询薪资账套的员工信息字段
List<SalarySobEmpFieldPO> salarySobEmpFieldPOS = getSalarySobEmpFieldService(user).listBySalarySobId(salarySobId);
// 查询薪资账套的薪资项目分类
List<SalarySobItemGroupPO> salarySobItemGroupPOS = getSalarySobItemGroupService(user).listBySalarySobIdWithItemHide(salarySobId);
List<SalarySobEmpFieldPO> salarySobEmpFieldPOS = salaryAcctConfig.getSalarySobEmpFields();
// 获取关闭显示的分类
List<Long> hideGroupIDs = getSalarySobItemHideService(user).listHideGroupBysalarySobId(SalarySobItemHidePO.builder().salarySobId(salarySobId).isGroup(1).build());
// 过滤关闭显示的薪资项目分类
salarySobItemGroupPOS = salarySobItemGroupPOS.stream().filter(group -> !(hideGroupIDs.contains(group.getId()))).collect(Collectors.toList());
// 获取薪资项目分类ID
List<Long> salarySobItemGroupIds = salarySobItemGroupPOS.stream().map(SalarySobItemGroupPO::getId).collect(Collectors.toList());
salarySobItemGroupIds.add(0L);
// 查询薪资账套的薪资项目分类
List<SalarySobItemGroupPO> salarySobItemGroupPOS = salaryAcctConfig.getSalarySobItemGroups();
salarySobItemGroupPOS = salarySobItemGroupPOS.stream().filter(po -> po.getItemHide() == null || po.getItemHide().equals(0L)).collect(Collectors.toList());
// 查询薪资账套的薪资项目副本(已经过滤关闭分类显示按钮的薪资项目)
List<SalarySobItemPO> salarySobItemPOS = listBySalarySobIdAndGroupId(salarySobId, salarySobItemGroupIds);
// 获取关闭显示的薪资项目
List<Long> hideItemIDs = getSalarySobItemHideService(user).listHideGroupBysalarySobId(SalarySobItemHidePO.builder().salarySobId(salarySobId).isGroup(0).build());
salarySobItemPOS = salarySobItemPOS.stream().filter(group -> !(hideItemIDs.contains(group.getSalaryItemId()))).collect(Collectors.toList());
List<SalarySobItemPO> salarySobItemPOS = salaryAcctConfig.getSalarySobItems();
salarySobItemPOS = salarySobItemPOS.stream().filter(po -> po.getItemHide() == null || po.getItemHide().equals(0L)).collect(Collectors.toList());
// 回算薪资项目
List<SalarySobBackItemPO> salarySobBackItems = Collections.emptyList();
if (isBackCalc) {
salarySobBackItems = getSalarySobBackItemService(user).listBySalarySobId(salarySobId);
salarySobBackItems = salaryAcctConfig.getSalarySobBackItems();
}
// 薪资账套的薪资项目副本所用的公式id
@ -337,9 +331,6 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
List<SalaryItemPO> allSalaryItemList = getSalaryItemService(user).listAll();
Map<Long, SalaryItemPO> salaryItemsMap = SalaryEntityUtil.convert2Map(allSalaryItemList, SalaryItemPO::getId);
// 需要保存的隐藏项目
List<SalarySobItemHidePO> needInsertItemShow = new ArrayList<>();
//先保存项目分类获取分类id
Collection<SalarySobItemPO> salarySobItems = new ArrayList<>();
for (SalarySobItemSaveParam.SalarySobItemGroupParam itemGroupParam : needAddGroup) {
@ -349,6 +340,7 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
.salarySobId(salarySobId)
.name(itemGroupParam.getName())
.sortedIndex(itemGroupParam.getSortedIndex())
.itemHide(itemGroupParam.getItemHide())
.description(StringUtils.EMPTY)
.creator(employeeId)
.createTime(now)
@ -360,24 +352,6 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
salarySobItemGroupBiz.insert(salarySobItemGroupPO);
// 保存薪资项目分类 字段显隐
Long salarySobGroupItemShowId = IdGenerator.generate();
SalarySobItemHidePO salarySobGroupItemHidePO = SalarySobItemHidePO.builder()
.id(salarySobGroupItemShowId)
.salarySobId(salarySobId)
.salaryItemId(salarySobItemGroupId)
.isGroup(1)
.itemHide(itemGroupParam.getItemHide() == null ? 0L : itemGroupParam.getItemHide())
.creator(employeeId)
.createTime(now)
.updateTime(now)
.deleteType(NumberUtils.INTEGER_ZERO)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build();
needInsertItemShow.add(salarySobGroupItemHidePO);
// salarySobItemMapper.InsertItemShow(salarySobGroupItemHidePO);
for (SalarySobItemSaveParam.SalarySobItemParam itemParam : itemGroupParam.getItems()) {
SalaryItemPO salaryItemPO = checkItemExists(itemParam.getSalaryItemId(), salaryItemsMap);
SalarySobItemPO salarySobItemPO = SalarySobItemPO.builder()
@ -396,26 +370,9 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
.roundingMode(itemParam.getRoundingMode() == null ? salaryItemPO.getRoundingMode() : itemParam.getRoundingMode())
.pattern(itemParam.getPattern() == null ? salaryItemPO.getPattern() : itemParam.getPattern())
.valueType(itemParam.getValueType() == null ? salaryItemPO.getValueType() : itemParam.getValueType())
.itemHide(itemParam.getItemHide())
.build();
salarySobItems.add(salarySobItemPO);
// 保存薪资项目是否展示
Long salarySobItemShowId = IdGenerator.generate();
SalarySobItemHidePO salarySobItemHidePO = SalarySobItemHidePO.builder()
.id(salarySobItemShowId)
.salarySobId(salarySobId)
.salaryItemId(itemParam.getSalaryItemId())
.isGroup(0)
.itemHide(itemParam.getItemHide())
.creator(employeeId)
.createTime(now)
.updateTime(now)
.deleteType(NumberUtils.INTEGER_ZERO)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build();
// salarySobItemMapper.InsertItemShow(salarySobItemHidePO);
needInsertItemShow.add(salarySobItemHidePO);
}
}
@ -427,27 +384,11 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
.id(groupId)
.name(itemGroupParam.getName())
.sortedIndex(itemGroupParam.getSortedIndex())
.itemHide(itemGroupParam.getItemHide())
.build();
//更新分类
salarySobItemGroupBiz.update(salarySobItemGroupPO);
// 保存薪资项目分类 字段显隐
Long salarySobGroupItemShowId = IdGenerator.generate();
SalarySobItemHidePO salarySobGroupItemHidePO = SalarySobItemHidePO.builder()
.id(salarySobGroupItemShowId)
.salarySobId(salarySobId)
.salaryItemId(groupId)
.isGroup(1)
.itemHide(itemGroupParam.getItemHide() == null ? 0L : itemGroupParam.getItemHide())
.creator(employeeId)
.createTime(now)
.updateTime(now)
.deleteType(NumberUtils.INTEGER_ZERO)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build();
needInsertItemShow.add(salarySobGroupItemHidePO);
List<SalarySobItemSaveParam.SalarySobItemParam> items = itemGroupParam.getItems();
List<Long> itemIds = SalaryEntityUtil.properties(items, SalarySobItemSaveParam.SalarySobItemParam::getId, Collectors.toList());
List<SalarySobItemPO> oldItems = salarySobItemMapper.listBySalarySobIdAndGroupId(salarySobId, Collections.singleton(groupId));
@ -475,24 +416,9 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
.roundingMode(itemParam.getRoundingMode() == null ? salaryItemPO.getRoundingMode() : itemParam.getRoundingMode())
.pattern(itemParam.getPattern() == null ? salaryItemPO.getPattern() : itemParam.getPattern())
.valueType(itemParam.getValueType() == null ? salaryItemPO.getValueType() : itemParam.getValueType())
.itemHide(itemParam.getItemHide())
.build();
salarySobItems.add(salarySobItemPO);
// 保存薪资项目是否展示
Long salarySobItemShowId = IdGenerator.generate();
SalarySobItemHidePO salarySobItemHidePO = SalarySobItemHidePO.builder()
.id(salarySobItemShowId)
.salarySobId(salarySobId)
.salaryItemId(itemParam.getSalaryItemId())
.isGroup(0)
.itemHide(itemParam.getItemHide())
.creator(employeeId)
.createTime(now)
.updateTime(now)
.deleteType(NumberUtils.INTEGER_ZERO)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build();
needInsertItemShow.add(salarySobItemHidePO);
}
//更新
for (SalarySobItemSaveParam.SalarySobItemParam itemParam : needUpdateItems) {
@ -509,22 +435,10 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
.roundingMode(itemParam.getRoundingMode() == null ? salaryItemPO.getRoundingMode() : itemParam.getRoundingMode())
.pattern(itemParam.getPattern() == null ? salaryItemPO.getPattern() : itemParam.getPattern())
.valueType(itemParam.getValueType() == null ? salaryItemPO.getValueType() : itemParam.getValueType())
.itemHide(itemParam.getItemHide())
.build();
getSalarySobItemMapper().updateIgnoreNull(salarySobItemPO);
// 保存薪资项目是否展示
Long salarySobItemShowId = IdGenerator.generate();
needInsertItemShow.add(SalarySobItemHidePO.builder()
.id(salarySobItemShowId)
.salarySobId(salarySobId)
.salaryItemId(itemParam.getSalaryItemId())
.isGroup(0)
.itemHide(itemParam.getItemHide())
.creator(employeeId)
.createTime(now)
.updateTime(now)
.deleteType(NumberUtils.INTEGER_ZERO)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build());
}
@ -565,25 +479,9 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
.roundingMode(itemParam.getRoundingMode() == null ? salaryItemPO.getRoundingMode() : itemParam.getRoundingMode())
.pattern(itemParam.getPattern() == null ? salaryItemPO.getPattern() : itemParam.getPattern())
.valueType(itemParam.getValueType() == null ? salaryItemPO.getValueType() : itemParam.getValueType())
.itemHide(itemParam.getItemHide())
.build();
salarySobItems.add(salarySobItemPO);
// 保存未分类薪资项目是否展示
Long salarySobItemShowId = IdGenerator.generate();
SalarySobItemHidePO salarySobItemHidePO = SalarySobItemHidePO.builder()
.id(salarySobItemShowId)
.salarySobId(salarySobId)
.salaryItemId(itemParam.getSalaryItemId())
.isGroup(0)
.itemHide(itemParam.getItemHide())
.creator(employeeId)
.createTime(now)
.updateTime(now)
.deleteType(NumberUtils.INTEGER_ZERO)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build();
// salarySobItemMapper.InsertItemShow(salarySobItemHidePO);
needInsertItemShow.add(salarySobItemHidePO);
}
for (SalarySobItemSaveParam.SalarySobItemParam itemParam : needUpdateItems) {
@ -597,25 +495,9 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
.roundingMode(itemParam.getRoundingMode() == null ? salaryItemPO.getRoundingMode() : itemParam.getRoundingMode())
.pattern(itemParam.getPattern() == null ? salaryItemPO.getPattern() : itemParam.getPattern())
.valueType(itemParam.getValueType() == null ? salaryItemPO.getValueType() : itemParam.getValueType())
.itemHide(itemParam.getItemHide())
.build();
getSalarySobItemMapper().updateIgnoreNull(salarySobItemPO);
// 保存未分类薪资项目是否展示
Long salarySobItemShowId = IdGenerator.generate();
SalarySobItemHidePO salarySobItemHidePO = SalarySobItemHidePO.builder()
.id(salarySobItemShowId)
.salarySobId(salarySobId)
.salaryItemId(itemParam.getSalaryItemId())
.isGroup(0)
.itemHide(itemParam.getItemHide())
.creator(employeeId)
.createTime(now)
.updateTime(now)
.deleteType(NumberUtils.INTEGER_ZERO)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build();
// salarySobItemMapper.InsertItemShow(salarySobItemHidePO);
needInsertItemShow.add(salarySobItemHidePO);
}
if (CollectionUtils.isNotEmpty(needDeleteItemIds)) {
@ -627,8 +509,6 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
// 删除原薪资项目是否显示
deleteItemShowBySalarySobIds(Collections.singleton(salarySobId));
// 保存薪资账套的薪资项目隐藏信息
batchSaveShow(needInsertItemShow);
}
private SalaryItemPO checkItemExists(Long salaryItemId, Map<Long, SalaryItemPO> salaryItemsMap) {
@ -694,17 +574,6 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
salarySobItemMapper.batchInsert(list);
}
private void batchSaveShow(List<SalarySobItemHidePO> needInsertItemShow) {
if (CollectionUtils.isEmpty(needInsertItemShow)) {
return;
}
//前端可能传重复数据去重
List<SalarySobItemHidePO> list = new ArrayList<>(needInsertItemShow.stream()
.collect(Collectors.toMap(SalarySobItemHidePO::getSalaryItemId, Function.identity(), (oldValue, newValue) -> oldValue))
.values());
salarySobItemMapper.batchInsertItemShow(list);
}
@Override
public void deleteBySalarySobIds(Collection<Long> salarySobIds) {
salarySobItemMapper.deleteBySalarySobIds(salarySobIds);

View File

@ -675,7 +675,7 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
// 薪资项目副本去重
salarySobItemPOS = salarySobItemPOS.stream().filter(SalaryEntityUtil.distinctByKey(PO -> PO.getSalarySobId() + "-" + PO.getSalaryItemId())).collect(Collectors.toList());
// 查询薪资账套的薪资项目分类
List<SalarySobItemGroupPO> salarySobItemGroupPOS = salarySobItemGroupService.listSomeWithItemHide(SalarySobItemGroupPO.builder().salarySobId(duplicateParam.getId()).build());
List<SalarySobItemGroupPO> salarySobItemGroupPOS = salarySobItemGroupService.listSome(SalarySobItemGroupPO.builder().salarySobId(duplicateParam.getId()).build());
// 查询薪资账套的调薪计薪规则
List<SalarySobAdjustRulePO> salarySobAdjustRulePOS = salarySobAdjustRuleService.listBySalarySobId(duplicateParam.getId());
// 查询薪资账套的校验规则

View File

@ -308,7 +308,7 @@ public class SalaryTemplateServiceImpl extends Service implements SalaryTemplate
List<String> empFieldCodeList = salarySobEmpFieldPOS.stream().map(SalarySobEmpFieldPO::getFieldCode).collect(Collectors.toList());
Map<String, Long> empFieldCodeWithIdMap = SalaryEntityUtil.convert2Map(salarySobEmpFieldPOS, SalarySobEmpFieldPO::getFieldCode, SalarySobEmpFieldPO::getId);
// 查询薪资账套的薪资项目副本
List<SalarySobItemPO> salarySobItemPOS = getSalarySobItemService(user).listBySalarySobIdWithHideItem(copyParam.getSalarySobId());
List<SalarySobItemPO> salarySobItemPOS = getSalarySobItemService(user).listBySalarySobId(copyParam.getSalarySobId());
List<Long> salaryItemIdList = salarySobItemPOS.stream().map(SalarySobItemPO::getSalaryItemId).collect(Collectors.toList());
//拷贝数据中的薪资项目
List<SalaryTemplateSalaryItemSetListDTO> salaryItemSettingList = StrUtil.isNotBlank(salaryTemplate.getSalaryItemSetting())

View File

@ -0,0 +1,40 @@
package com.engine.salary.util.valid;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 比较判断两个实体字段是否改变
* <p>Copyright: Copyright (c) 2024</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Compare {
/**
* 是否提示错误
*
* @return
*/
boolean reportError() default false;
/**
* 提示信息
* @return
*/
String message() default "";
/**
* 值类型
*
* @return
*/
ValueTypeEnum type() default ValueTypeEnum.STRING;
}

View File

@ -1,8 +1,12 @@
package com.engine.salary.util.valid;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.util.SalaryI18nUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import weaver.general.Util;
import java.beans.BeanInfo;
import java.beans.Introspector;
@ -20,6 +24,7 @@ import java.util.*;
* @author qiantao
* @version 1.0
**/
@Slf4j
public class ValidUtil {
/**
@ -135,6 +140,7 @@ public class ValidUtil {
}
} catch (Exception e) {
e.printStackTrace();
log.error("获取属性值失败", e);
}
return value;
}
@ -199,6 +205,12 @@ public class ValidUtil {
return convertSuccess;
}
/**
* 处理参数值trimxss
*
* @param t
* @param <T>
*/
public static <T> void modify(T t) {
Class<?> clazz = t.getClass();
Field[] fields = clazz.getDeclaredFields();
@ -251,5 +263,46 @@ public class ValidUtil {
}
}
/**
* 比较两个对象如果值不相等则抛出异常
* <p>
* true代表相等false代表不相等
*
* @param o
* @param n
* @param <T>
*/
public static <T> boolean compare(T o, T n) {
Class<?> clazz = o.getClass();
Field[] fields = clazz.getDeclaredFields();
boolean result = true;
for (Field field : fields) {
Compare rule = field.getDeclaredAnnotation(Compare.class);
if (null == rule) {
continue;
}
boolean reportError = rule.reportError();
String message = rule.message();
ValueTypeEnum valueTypeEnum = rule.type();
Object oValue = getValue(o, field.getName());
Object nValue = getValue(n, field.getName());
if (valueTypeEnum == ValueTypeEnum.STRING) {
result = result && StrUtil.equals(Util.null2String(oValue), Util.null2String(nValue));
if (!result && reportError) {
throw new RuntimeException(message);
}
} else if (valueTypeEnum == ValueTypeEnum.DATE) {
result = result && DateUtil.compare((Date) o, (Date) n) == 0;
if (!result && reportError) {
throw new RuntimeException(message);
}
} else if (valueTypeEnum == ValueTypeEnum.OBJECT) {
result = result && compare(oValue, nValue);
}
}
return result;
}
}

View File

@ -9,5 +9,5 @@ package com.engine.salary.util.valid;
* @version 1.0
**/
public enum ValueTypeEnum {
STRING, OBJECT,ARRAY
STRING, DATE, OBJECT, ARRAY
}

View File

@ -46,8 +46,6 @@ import java.util.stream.Collectors;
@Slf4j
public class SalaryAcctController {
private SalaryAcctRecordWrapper salaryAcctRecordWrapper;
private SalaryAcctRecordWrapper getSalaryAcctRecordWrapper(User user) {
return ServiceUtil.getService(SalaryAcctRecordWrapper.class, user);
}
@ -159,6 +157,35 @@ public class SalaryAcctController {
return new ResponseResult<Long, String>(user).run(getSalaryAcctRecordWrapper(user)::backCalculate, param.getSalaryAcctRecordId());
}
/**
* 检查薪资核算的账套配置是否发生变更
*
* @param id 薪资核算记录id
* @return
*/
@GET
@Path("/compareSobConfig")
@Produces(MediaType.APPLICATION_JSON)
public String compareSobConfig(@Context HttpServletRequest request, @Context HttpServletResponse response,@QueryParam(value = "id") Long id) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long, Boolean>(user).run(getSalaryAcctRecordWrapper(user)::compareSobConfig, id);
}
/**
* 更新薪资核算的账套配置
*
* @param id 薪资核算记录id
* @return
*/
@GET
@Path("/updateSobConfig")
@Produces(MediaType.APPLICATION_JSON)
public String updateSobConfig(@Context HttpServletRequest request, @Context HttpServletResponse response,@QueryParam(value = "id") Long id) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long, Boolean>(user).run(getSalaryAcctRecordWrapper(user)::updateSobConfig, id);
}
/* ********************************薪资核算记录相关 end*********************************/

View File

@ -2,8 +2,10 @@ package com.engine.salary.wrapper;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.cache.SalaryCacheKey;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryBill.dto.SalarySendCheckDTO;
import com.engine.salary.entity.salaryacct.bo.SalaryAcctConfig;
import com.engine.salary.entity.salaryacct.bo.SalaryAcctRecordBO;
import com.engine.salary.entity.salaryacct.dto.SalaryAcctEmployeeCountDTO;
import com.engine.salary.entity.salaryacct.dto.SalaryAcctRecordFormDTO;
@ -11,9 +13,11 @@ import com.engine.salary.entity.salaryacct.dto.SalaryAcctRecordListDTO;
import com.engine.salary.entity.salaryacct.param.SalaryAcctRecordQueryParam;
import com.engine.salary.entity.salaryacct.param.SalaryAcctRecordSaveParam;
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctSobConfigPO;
import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.entity.salarysob.po.*;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.service.*;
import com.engine.salary.service.impl.*;
@ -22,8 +26,10 @@ import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.SalarySobUtil;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.valid.ValidUtil;
import com.engine.salary.wrapper.proxy.SalaryAcctRecordWrapperProxy;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import weaver.hrm.User;
@ -68,6 +74,15 @@ public class SalaryAcctRecordWrapper extends Service implements SalaryAcctRecord
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
}
private SalaryAcctSobConfigService getSalaryAcctSobConfigService(User user) {
return ServiceUtil.getService(SalaryAcctSobConfigServiceImpl.class, user);
}
private SalaryCacheService getSalaryCacheService(User user) {
return ServiceUtil.getService(SalaryCacheServiceImpl.class, user);
}
// private ComInfoCache comInfoCache;
public PageInfo<SalaryAcctRecordListDTO> listPage(SalaryAcctRecordQueryParam queryParam) {
@ -246,7 +261,6 @@ public class SalaryAcctRecordWrapper extends Service implements SalaryAcctRecord
}
/**
* 判断是否存在合并计税
*
@ -258,12 +272,91 @@ public class SalaryAcctRecordWrapper extends Service implements SalaryAcctRecord
}
/**
* @description 回算
* @return void
* @description 回算
* @author Harryxzy
* @date 2022/11/24 15:52
*/
public void backCalculate(Long salaryAcctRecordId){
public void backCalculate(Long salaryAcctRecordId) {
getSalaryAcctRecordService(user).backCalculate(salaryAcctRecordId);
}
/**
* 薪资核算的账套配置是否已经发生变更
*
* @param id
* @return true--发生了变更false--没有发生变更
*/
public boolean compareSobConfig(Long id) {
SalaryAcctRecordPO salaryAcctRecord = getSalaryAcctRecordService(user).getById(id);
if (salaryAcctRecord == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(156474, "参数错误,薪资核算记录不存在或已被删除"));
}
// 查询薪资核算记录已有的账套配置
SalaryAcctSobConfigPO salaryAcctSobConfig = getSalaryAcctSobConfigService(user).getBySalaryAcctRecordId(false, id);
// 查询最新的账套配置
SalaryAcctSobConfigPO newSalaryAcctSobConfig = getSalaryAcctSobConfigService(user).initBySalaryAcctRecord(salaryAcctRecord);
if (Objects.isNull(salaryAcctSobConfig)) {
// 为避免并发造成的事物问题需要做一下并发处理
String cacheIndex = id.toString();
String acctSobConfigFlag = getSalaryCacheService(user).get(SalaryCacheKey.ACCT_SOB_CONFIG + cacheIndex);
if (acctSobConfigFlag != null && StringUtils.equals(acctSobConfigFlag, "TRUE")) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(160540, "其他人员正在操作此条薪资核算记录,请稍后再试"));
}
getSalaryCacheService(user).set(SalaryCacheKey.ACCT_SOB_CONFIG + cacheIndex, "TRUE");
getSalaryAcctSobConfigService(user).save(newSalaryAcctSobConfig);
getSalaryCacheService(user).remove(SalaryCacheKey.ACCT_SOB_CONFIG + cacheIndex);
return false;
}
// 如果薪资核算记录已经归档了不再校验薪资核算的账套配置是否已经发生变更
if (!Objects.equals(salaryAcctRecord.getStatus(), SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue())) {
return false;
}
SalaryAcctConfig config = SalaryAcctConfig.parse(salaryAcctSobConfig);
SalaryAcctConfig newConfig = SalaryAcctConfig.parse(newSalaryAcctSobConfig);
// 判断账套配置是否已经变更了
SalarySobPO salarySobPO = config.getSalarySob();
SalarySobPO newSalarySobPO = newConfig.getSalarySob();
if (!ValidUtil.compare(salarySobPO, newSalarySobPO)) {
return true;
}
List<SalarySobEmpFieldPO> salarySobEmpFields = config.getSalarySobEmpFields();
List<SalarySobEmpFieldPO> newSalarySobEmpFields = newConfig.getSalarySobEmpFields();
if (SalarySobEmpFieldPO.toCompareString(salarySobEmpFields).compareTo(SalarySobEmpFieldPO.toCompareString(newSalarySobEmpFields)) != 0) {
return true;
}
List<SalarySobItemGroupPO> salarySobItemGroups = config.getSalarySobItemGroups();
List<SalarySobItemGroupPO> newSalarySobItemGroups = newConfig.getSalarySobItemGroups();
if (SalarySobItemGroupPO.toCompareString(salarySobItemGroups).compareTo(SalarySobItemGroupPO.toCompareString(newSalarySobItemGroups)) != 0) {
return true;
}
List<SalarySobItemPO> salarySobItems = config.getSalarySobItems();
List<SalarySobItemPO> newSalarySobItems = newConfig.getSalarySobItems();
if (SalarySobItemPO.toCompareString(salarySobItems).compareTo(SalarySobItemPO.toCompareString(newSalarySobItems)) != 0) {
return true;
}
List<SalarySobBackItemPO> salarySobBackItems = config.getSalarySobBackItems();
List<SalarySobBackItemPO> newSalarySobBackItems = newConfig.getSalarySobBackItems();
if (SalarySobBackItemPO.toCompareString(salarySobBackItems).compareTo(SalarySobBackItemPO.toCompareString(newSalarySobBackItems)) != 0) {
return true;
}
return false;
}
/**
* 更新薪资核算的账套配置
*
* @param id
*/
public void updateSobConfig(Long id) {
getSalaryAcctSobConfigService(user).updateBySalaryAcctRecordId(id);
}
}

View File

@ -84,7 +84,7 @@ public class SalaryItemWrapper extends Service {
List<String> usingCodes = usingItem.getUsingCodes();
//删除无用公式
getSalaryFormulaService(user).deleteNotIn(usingFormulaIds);
// getSalaryFormulaService(user).deleteNotIn(usingFormulaIds);
//薪资档案引用的项目转移到字段管理功能项
searchParam.setUseInEmployeeSalary(SalaryOnOffEnum.OFF.getValue());

View File

@ -66,6 +66,11 @@ public class SalarySobWrapper extends Service {
return ServiceUtil.getService(SysSalaryItemServiceImpl.class, user);
}
private SalarySobItemService getSalarySobItemService(User user) {
return ServiceUtil.getService(SalarySobItemServiceImpl.class, user);
}
/**
* 薪资账套列表