考勤引用适配加班数据

This commit is contained in:
钱涛 2022-07-07 14:37:10 +08:00
parent b23f790fc9
commit 16c43f8679
1 changed files with 24 additions and 9 deletions

View File

@ -12,6 +12,7 @@ import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.general.Util;
import java.util.*;
import java.util.stream.Collectors;
@ -47,7 +48,7 @@ public class RemoteAttend4SalaryServiceImpl extends Service implements RemoteAtt
.forEach(leave -> {
Map<String, String> map = Maps.newHashMapWithExpectedSize(2);
map.put("code", leave.get("dataIndex").toString());
map.put("name", leave.get("title") + "(" + leave.get("unit").toString() + ")");
map.put("name", Util.null2String(column.get("title")) + "-" + leave.get("title") + "(" + leave.get("unit").toString() + ")");
columns.add(map);
});
}
@ -56,14 +57,28 @@ public class RemoteAttend4SalaryServiceImpl extends Service implements RemoteAtt
else if (dataIndex.equals("overtime") && column.get("children") != null) {
List<Map> list = (List<Map>) column.get("children");
if (CollectionUtils.isNotEmpty(list)) {
list.stream()
.filter(leave -> leave.get("dataIndex") != null && StringUtils.isNotBlank(leave.get("dataIndex").toString()))
.forEach(leave -> {
Map<String, String> map = Maps.newHashMapWithExpectedSize(2);
map.put("code", leave.get("dataIndex").toString());
map.put("name", leave.get("title") + "(" + leave.get("unit").toString() + ")");
columns.add(map);
});
for (int i = 0; i < list.size(); i++) {
Map overtimeMap = list.get(i);
if (overtimeMap.get("dataIndex") != null && StringUtils.isNotBlank(overtimeMap.get("dataIndex").toString()) && overtimeMap.get("children") == null) {
Map<String, String> map = Maps.newHashMapWithExpectedSize(2);
map.put("code", overtimeMap.get("dataIndex").toString());
map.put("name", Util.null2String(column.get("title")) + "-" + overtimeMap.get("title") + "(" + overtimeMap.get("unit").toString() + ")");
columns.add(map);
}
if (overtimeMap.get("dataIndex") != null && StringUtils.isNotBlank(overtimeMap.get("dataIndex").toString()) && overtimeMap.get("children") != null) {
List<Map> overtimes = (List<Map>) overtimeMap.get("children");
if (CollectionUtils.isNotEmpty(overtimes)) {
overtimes.stream().filter(leave -> leave.get("dataIndex") != null && StringUtils.isNotBlank(leave.get("dataIndex").toString()))
.forEach(leave -> {
Map<String, String> map = Maps.newHashMapWithExpectedSize(2);
map.put("code", leave.get("dataIndex").toString());
map.put("name", Util.null2String(column.get("title")) + "-" + Util.null2String(overtimeMap.get("title")) + "-" + leave.get("title") + "(" + leave.get("unit").toString() + ")");
columns.add(map);
});
}
}
}
}
}
//普通考勤