薪酬系统-福利台账,福利核算出现异常时,优化核算进度获取逻辑

This commit is contained in:
sy 2023-11-21 14:40:30 +08:00
parent 7f68931cc5
commit c9b279049d
2 changed files with 10 additions and 5 deletions

View File

@ -260,7 +260,7 @@ public class SIAccountBiz extends Service {
public void accounting(AccountParam param, Long employeeId, String tenantKey, String currentUserName) {
//薪资核算进度暂未实现
ProgressDTO salaryAcctProgressDTO = getSalaryAcctProgressService(user).getProgress(SalaryCacheKey.ACCT_PROGRESS + param.getBillMonth());
if (salaryAcctProgressDTO != null && salaryAcctProgressDTO.getProgress().compareTo(BigDecimal.ONE) < 0) {
if (salaryAcctProgressDTO != null && salaryAcctProgressDTO.isStatus() && salaryAcctProgressDTO.getProgress().compareTo(BigDecimal.ONE) < 0) {
return;
}
@ -399,8 +399,9 @@ public class SIAccountBiz extends Service {
log.info("福利核算进度完成!");
} catch (Exception e) {
log.error("account run fail", e);
getSalaryAcctProgressService(user).fail(SalaryCacheKey.ACCT_PROGRESS + param.getBillMonth(), SalaryI18nUtil.getI18nLabel(99642, "福利核算出错") + ": " + e.getMessage());
List<InsuranceAccountBatchPO> list = Lists.newArrayList(getInsuranceAccountBatchMapper().getByBillMonth(param.getBillMonth(), param.getPaymentOrganization()));
list = encryptUtil.decryptList(list, InsuranceAccountBatchPO.class);
if (CollectionUtils.isNotEmpty(list)) {
list.stream().forEach(f -> {
getInsuranceAccountBatchMapper().deleteById(f.getId());
@ -410,7 +411,6 @@ public class SIAccountBiz extends Service {
//薪资核算进度暂未实现
//salaryAcctProgressService.del(tenantKey + param.getBillMonth(), employeeId, tenantKey);
//logger.error("welfare account error:{}", e.getMessage(), e);
getSalaryAcctProgressService(user).fail(SalaryCacheKey.ACCT_PROGRESS + param.getBillMonth(), SalaryI18nUtil.getI18nLabel(99642, "福利核算出错") + ": " + e.getMessage());
}
}

View File

@ -2,6 +2,7 @@ package com.engine.salary.util;
import cn.hutool.core.util.StrUtil;
import com.engine.salary.common.LocalDateRange;
import com.engine.salary.exception.SalaryRunTimeException;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
@ -547,14 +548,18 @@ public class SalaryDateUtil {
if (StringUtils.isNotBlank(startMonth)) {
startMonth = startMonth + "-01";
Date socialStartDate = SalaryDateUtil.dateStrToLocalDate(startMonth);
if (billMonthDate.before(socialStartDate)) {
if(socialStartDate == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "年月解析异常,请检查档案中相关数据设置") + ":" + startMonth.substring(0, startMonth.length() - 3));
} else if (billMonthDate.before(socialStartDate)) {
inDataRange = false;
}
}
if (StringUtils.isNotBlank(endMonth)) {
endMonth = endMonth + "-01";
Date socialEndDate = SalaryDateUtil.dateStrToLocalDate(endMonth);
if (billMonthDate.after(socialEndDate)) {
if(socialEndDate == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "年月解析异常,请检查档案中相关数据设置") + ":" + endMonth.substring(0, endMonth.length() - 3));
} else if (billMonthDate.after(socialEndDate)) {
inDataRange = false;
}
}