过滤空数据
This commit is contained in:
parent
b0a23483e1
commit
90aedee761
|
|
@ -91,21 +91,23 @@ public class DepartureAnnualLeaveJob extends BaseCronJob {
|
|||
// 计算应年假基数
|
||||
lastAttendanceMap.forEach((id, localDate) -> {
|
||||
BalanceOfLeaveDTO balanceOfLeaveDTO = balanceOfLeaveDTOMap.get(id + "-" + localDate.getYear());
|
||||
// 离职前日历天数= 末次考勤日-当年1号+1
|
||||
LocalDate firstDayOfYear = localDate.withDayOfYear(1);
|
||||
long dayBeforeLeave = firstDayOfYear.until(localDate, ChronoUnit.DAYS) + 1;
|
||||
String ynjjs = BigDecimal.valueOf(dayBeforeLeave).divide(BigDecimal.valueOf(365), 5, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(balanceOfLeaveDTO.getBaseAmount())).toString();
|
||||
// 保留一位小数,不满0.5取0,满0.5 不满1,取0.5
|
||||
if (ynjjs.contains(".")) {
|
||||
Integer value = Integer.valueOf(ynjjs.substring(ynjjs.indexOf(".") + 1 , ynjjs.indexOf(".") + 2));
|
||||
if (value >= 5) {
|
||||
ynjjs = ynjjs.substring(0, ynjjs.indexOf(".")) + ".5";
|
||||
} else {
|
||||
ynjjs = ynjjs.substring(0, ynjjs.indexOf(".")) + ".0";
|
||||
if (balanceOfLeaveDTO != null) {
|
||||
// 离职前日历天数= 末次考勤日-当年1号+1
|
||||
LocalDate firstDayOfYear = localDate.withDayOfYear(1);
|
||||
long dayBeforeLeave = firstDayOfYear.until(localDate, ChronoUnit.DAYS) + 1;
|
||||
String ynjjs = BigDecimal.valueOf(dayBeforeLeave).divide(BigDecimal.valueOf(365), 5, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(balanceOfLeaveDTO.getBaseAmount())).toString();
|
||||
// 保留一位小数,不满0.5取0,满0.5 不满1,取0.5
|
||||
if (ynjjs.contains(".")) {
|
||||
Integer value = Integer.valueOf(ynjjs.substring(ynjjs.indexOf(".") + 1 , ynjjs.indexOf(".") + 2));
|
||||
if (value >= 5) {
|
||||
ynjjs = ynjjs.substring(0, ynjjs.indexOf(".")) + ".5";
|
||||
} else {
|
||||
ynjjs = ynjjs.substring(0, ynjjs.indexOf(".")) + ".0";
|
||||
}
|
||||
}
|
||||
balanceOfLeaveDTO.setYnjjs(Float.valueOf(ynjjs));
|
||||
balanceOfLeaveDTO.setXzszy(SalaryDateUtil.getFormatLocalDate(localDate.withDayOfMonth(1)));
|
||||
}
|
||||
balanceOfLeaveDTO.setYnjjs(Float.valueOf(ynjjs));
|
||||
balanceOfLeaveDTO.setXzszy(SalaryDateUtil.getFormatLocalDate(localDate.withDayOfMonth(1)));
|
||||
});
|
||||
|
||||
// 先查出插入前的最大id
|
||||
|
|
|
|||
Loading…
Reference in New Issue