需求变更20250205 不使用年月字段 数据存在即汇总统计

上海中远重工组织架构图
Chengliang 4 months ago
parent 6c54bae6f2
commit a0675f89a3

@ -765,7 +765,7 @@ public class ChartServiceImpl extends Service implements ChartService {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
String currentYearMonth = currentDateTime.format(formatter); String currentYearMonth = currentDateTime.format(formatter);
// 部门编制人数向下汇总 20250122 优化需求 // 部门编制人数向下汇总 20250122 优化需求 ==》需求变更20250205 不使用年月字段 数据存在即汇总统计
List<ModeStaffPO> bzList = new ArrayList<>(); List<ModeStaffPO> bzList = new ArrayList<>();
rs.executeQuery("select bzrs,ny from uf_bzgljmb where bm in ("+value+")"); rs.executeQuery("select bzrs,ny from uf_bzgljmb where bm in ("+value+")");
while (rs.next()) { while (rs.next()) {
@ -778,16 +778,16 @@ public class ChartServiceImpl extends Service implements ChartService {
int sum = 0; int sum = 0;
if (bzList.size() > 0) { if (bzList.size() > 0) {
Map<String, List<ModeStaffPO>> groupedByMonthYear = bzList.stream() // Map<String, List<ModeStaffPO>> groupedByMonthYear = bzList.stream()
.collect(Collectors.groupingBy(ModeStaffPO::getMonthYear)); // .collect(Collectors.groupingBy(ModeStaffPO::getMonthYear));
//
// 获取最新的 monthYear // // 获取最新的 monthYear
String latestMonthYear = groupedByMonthYear.keySet().stream() // String latestMonthYear = groupedByMonthYear.keySet().stream()
.max(String::compareTo) // .max(String::compareTo)
.orElse(null); // .orElse(null);
List<ModeStaffPO> modeStaffPOS = groupedByMonthYear.get(latestMonthYear); // List<ModeStaffPO> modeStaffPOS = groupedByMonthYear.get(latestMonthYear);
sum = modeStaffPOS.stream().mapToInt(ModeStaffPO::getCount).sum(); sum = bzList.stream().mapToInt(ModeStaffPO::getCount).sum();
} }

Loading…
Cancel
Save