杭州五院分段计算
This commit is contained in:
parent
6cc1d84657
commit
a8b2c7e8e9
|
|
@ -364,6 +364,9 @@ public class CalculateFormulaVarBO {
|
||||||
|
|
||||||
// 上月薪资周期
|
// 上月薪资周期
|
||||||
LocalDateRange lastMonthSalaryCycle = salaryAcctCalculateBO.getLastMonthSalarySobCycleDTO().getSalaryCycle();
|
LocalDateRange lastMonthSalaryCycle = salaryAcctCalculateBO.getLastMonthSalarySobCycleDTO().getSalaryCycle();
|
||||||
|
String lastMonthSalaryCycleFromDate = SalaryDateUtil.getFormatLocalDate(lastMonthSalaryCycle.getFromDate());
|
||||||
|
String thisMonthSalaryCycleFromDate = SalaryDateUtil.getFormatLocalDate(salaryAcctCalculateBO.getSalarySobCycleDTO().getSalaryCycle().getFromDate());
|
||||||
|
|
||||||
// 将薪资档案的调薪记录按照薪资项目id聚合(同一个薪资项目可能存在多次调薪,按照生效日期对调薪记录排序)
|
// 将薪资档案的调薪记录按照薪资项目id聚合(同一个薪资项目可能存在多次调薪,按照生效日期对调薪记录排序)
|
||||||
Map<Long, List<SalaryArchiveItemDataDTO>> lastMonthdataMap = lastMonthSalaryItemValues.stream()
|
Map<Long, List<SalaryArchiveItemDataDTO>> lastMonthdataMap = lastMonthSalaryItemValues.stream()
|
||||||
.collect(Collectors.groupingBy(SalaryArchiveItemDataDTO::getSalaryItemId,
|
.collect(Collectors.groupingBy(SalaryArchiveItemDataDTO::getSalaryItemId,
|
||||||
|
|
@ -377,24 +380,62 @@ public class CalculateFormulaVarBO {
|
||||||
String value;
|
String value;
|
||||||
// 获取薪资项目的调薪规则
|
// 获取薪资项目的调薪规则
|
||||||
SalarySobAdjustRulePO salaryAdjustmentRulePO = salarySobAdjustRulePOMap.get(entry.getKey());
|
SalarySobAdjustRulePO salaryAdjustmentRulePO = salarySobAdjustRulePOMap.get(entry.getKey());
|
||||||
if (entry.getValue().size() > 2) {
|
// if (entry.getValue().size() > 2) {
|
||||||
// 如果薪资项目在薪资周期内经历了多次调薪,则默认分段计薪
|
// // 如果薪资项目在薪资周期内经历了多次调薪,则默认分段计薪
|
||||||
value = calculateBySalarySobAdjustRule(salaryCycle, SalarySobAdjustRuleTypeEnum.PARTITION, entry.getValue());
|
// value = calculateBySalarySobAdjustRule(salaryCycle, SalarySobAdjustRuleTypeEnum.PARTITION, entry.getValue());
|
||||||
} else if (salaryAdjustmentRulePO == null || entry.getValue().size() < 2) {
|
// } else if (salaryAdjustmentRulePO == null || entry.getValue().size() < 2) {
|
||||||
// 如果薪资项目没有设置调薪计薪规则,默认取薪资周期内薪资档案中最新的值
|
// // 如果薪资项目没有设置调薪计薪规则,默认取薪资周期内薪资档案中最新的值
|
||||||
// 如果薪资项目在薪资周期内没有调薪,默认取薪资周期内薪资档案中最新的值
|
// // 如果薪资项目在薪资周期内没有调薪,默认取薪资周期内薪资档案中最新的值
|
||||||
value = calculateBySalarySobAdjustRule(salaryCycle, SalarySobAdjustRuleTypeEnum.USE_AFTER_ADJUSTMENT, entry.getValue());
|
// value = calculateBySalarySobAdjustRule(salaryCycle, SalarySobAdjustRuleTypeEnum.USE_AFTER_ADJUSTMENT, entry.getValue());
|
||||||
|
// } else {
|
||||||
|
// // 如果薪资项目在薪资周期内只有一次调薪,则根据调薪计薪规则处理
|
||||||
|
// SalarySobAdjustRuleTypeEnum adjustRuleTypeEnum = salaryAdjustmentRulePO.getDayOfMonth() < SalaryDateUtil.dateToLocalDate(entry.getValue().get(0).getEffectiveDateRange().getEndDate()).getDayOfMonth()
|
||||||
|
// ? SalarySobAdjustRuleTypeEnum.parseByValue(salaryAdjustmentRulePO.getAfterAdjustmentType())
|
||||||
|
// : SalarySobAdjustRuleTypeEnum.parseByValue(salaryAdjustmentRulePO.getBeforeAdjustmentType());
|
||||||
|
// // 根据调薪计薪规则处理薪资档案的调薪
|
||||||
|
// value = calculateBySalarySobAdjustRule(salaryCycle, adjustRuleTypeEnum, entry.getValue());
|
||||||
|
// }
|
||||||
|
List<SalaryArchiveItemDataDTO> thisMonthEntryValue = new ArrayList<>();
|
||||||
|
if (CollectionUtils.isEmpty(entry.getValue())) {
|
||||||
|
thisMonthEntryValue = new ArrayList<>();
|
||||||
|
SalaryArchiveItemDataDTO zeroData = SalaryArchiveItemDataDTO.builder().effectiveDateRange(salaryAcctCalculateBO.getSalarySobCycleDTO().getSalaryCycle()).salaryItemId(entry.getKey()).value("0").build();
|
||||||
|
thisMonthEntryValue.add(zeroData);
|
||||||
} else {
|
} else {
|
||||||
// 如果薪资项目在薪资周期内只有一次调薪,则根据调薪计薪规则处理
|
thisMonthEntryValue = entry.getValue();
|
||||||
SalarySobAdjustRuleTypeEnum adjustRuleTypeEnum = salaryAdjustmentRulePO.getDayOfMonth() < SalaryDateUtil.dateToLocalDate(entry.getValue().get(0).getEffectiveDateRange().getEndDate()).getDayOfMonth()
|
// 如果第一个生效范围的起始日不是,薪资周期起始日,在最前面补一条为值0的数据
|
||||||
? SalarySobAdjustRuleTypeEnum.parseByValue(salaryAdjustmentRulePO.getAfterAdjustmentType())
|
String effectiveFromDate = SalaryDateUtil.getFormatLocalDate(entry.getValue().get(0).getEffectiveDateRange().getFromDate());
|
||||||
: SalarySobAdjustRuleTypeEnum.parseByValue(salaryAdjustmentRulePO.getBeforeAdjustmentType());
|
if (!thisMonthSalaryCycleFromDate.equals(effectiveFromDate)) {
|
||||||
// 根据调薪计薪规则处理薪资档案的调薪
|
LocalDateRange localDateRange = LocalDateRange.builder()
|
||||||
value = calculateBySalarySobAdjustRule(salaryCycle, adjustRuleTypeEnum, entry.getValue());
|
.fromDate(salaryAcctCalculateBO.getSalarySobCycleDTO().getSalaryCycle().getFromDate())
|
||||||
|
.endDate(entry.getValue().get(0).getEffectiveDateRange().getFromDate())
|
||||||
|
.build();
|
||||||
|
SalaryArchiveItemDataDTO zeroData = SalaryArchiveItemDataDTO.builder().effectiveDateRange(localDateRange).salaryItemId(entry.getKey()).value("0").build();
|
||||||
|
thisMonthEntryValue.add(0, zeroData);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// 直接取调薪前的金额
|
||||||
|
value = calculateBySalarySobAdjustRule(salaryCycle, SalarySobAdjustRuleTypeEnum.USE_BEFORE_ADJUSTMENT, thisMonthEntryValue);
|
||||||
|
|
||||||
if (entry.getKey().equals(jbgzItemId) || entry.getKey().equals(gwgzItemId) || entry.getKey().equals(jxgzItemId)) {
|
if (entry.getKey().equals(jbgzItemId) || entry.getKey().equals(gwgzItemId) || entry.getKey().equals(jxgzItemId)) {
|
||||||
List<SalaryArchiveItemDataDTO> lastMonthEntryValue = lastMonthdataMap.get(entry.getKey());
|
List<SalaryArchiveItemDataDTO> lastMonthEntryValue = lastMonthdataMap.get(entry.getKey());
|
||||||
|
if (lastMonthEntryValue == null) {
|
||||||
|
lastMonthEntryValue = new ArrayList<>();
|
||||||
|
SalaryArchiveItemDataDTO zeroData = SalaryArchiveItemDataDTO.builder().effectiveDateRange(lastMonthSalaryCycle).salaryItemId(entry.getKey()).value("0").build();
|
||||||
|
lastMonthEntryValue.add(zeroData);
|
||||||
|
} else {
|
||||||
|
// 如果第一个生效范围的起始日不是,薪资周期起始日,补一条为值0的数据
|
||||||
|
String effectiveFromDate = SalaryDateUtil.getFormatLocalDate(lastMonthEntryValue.get(0).getEffectiveDateRange().getFromDate());
|
||||||
|
if (!lastMonthSalaryCycleFromDate.equals(effectiveFromDate)) {
|
||||||
|
LocalDateRange localDateRange = LocalDateRange.builder()
|
||||||
|
.fromDate(lastMonthSalaryCycle.getFromDate())
|
||||||
|
.endDate(lastMonthEntryValue.get(0).getEffectiveDateRange().getFromDate())
|
||||||
|
.build();
|
||||||
|
SalaryArchiveItemDataDTO zeroData = SalaryArchiveItemDataDTO.builder().effectiveDateRange(localDateRange).salaryItemId(entry.getKey()).value("0").build();
|
||||||
|
lastMonthEntryValue.add(0, zeroData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 绩效工资是需要获取上月的值(调薪前)
|
// 绩效工资是需要获取上月的值(调薪前)
|
||||||
if (entry.getKey().equals(jxgzItemId)) {
|
if (entry.getKey().equals(jxgzItemId)) {
|
||||||
value = CollectionUtils.isEmpty(lastMonthEntryValue) ? "0" : lastMonthEntryValue.get(0).getValue();
|
value = CollectionUtils.isEmpty(lastMonthEntryValue) ? "0" : lastMonthEntryValue.get(0).getValue();
|
||||||
|
|
@ -438,8 +479,10 @@ public class CalculateFormulaVarBO {
|
||||||
Date endDate = lastMonthSalaryCycle.getEndDate();
|
Date endDate = lastMonthSalaryCycle.getEndDate();
|
||||||
Date dismissDate = SalaryDateUtil.stringToDate(employee.getDismissdate());
|
Date dismissDate = SalaryDateUtil.stringToDate(employee.getDismissdate());
|
||||||
Date companystartdate = SalaryDateUtil.stringToDate(employee.getCompanystartdate());
|
Date companystartdate = SalaryDateUtil.stringToDate(employee.getCompanystartdate());
|
||||||
|
String status = employee.getStatus();
|
||||||
|
List<String> departureStatusList = Arrays.asList("4", "5", "6");
|
||||||
boolean needAccount = false;
|
boolean needAccount = false;
|
||||||
if (dismissDate != null && DateUtil.isIn(dismissDate, fromDate, endDate)) {
|
if (dismissDate != null && DateUtil.isIn(dismissDate, fromDate, endDate) && departureStatusList.contains(status)) {
|
||||||
needAccount = true;
|
needAccount = true;
|
||||||
}
|
}
|
||||||
if (companystartdate != null && DateUtil.isIn(companystartdate, fromDate, endDate)) {
|
if (companystartdate != null && DateUtil.isIn(companystartdate, fromDate, endDate)) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue