Commit e16637dc by 王璐琦

fix(daily-report): 修正门店总产值计算逻辑

- 改为循环累加各员工所属月份数据的产值总和
- 修正原先对最新记录直接求和导致统计不准确的问题
- 优化调用sumRowValuesAsBigDecimal方法计算每个员工分组的产值
- 使用resolveStaffGroupKey方法统一处理员工分组键获取
- 确保门店总产值计算覆盖所有相关月份数据
1 parent bdc31ef5
......@@ -1802,7 +1802,12 @@ public class DailyReportDataService {
}
Map<String, List<Map<String, String>>> monthRowsByStaff = buildMonthRowGroup(monthRecords, subformDataMap,
DailyReportFieldEnum.F2_58.getValue(), DailyReportFieldEnum.F2_58_1.getValue());
BigDecimal storeTotalOutput = sumRowValuesAsBigDecimal(latestRows, DailyReportFieldEnum.F2_58_4.getValue());
BigDecimal storeTotalOutput = BigDecimal.ZERO;
for (Map<String, String> latestRow : latestRows) {
String staffName = latestRow.get(DailyReportFieldEnum.F2_58_1.getValue());
List<Map<String, String>> staffMonthRows = monthRowsByStaff.getOrDefault(resolveStaffGroupKey(staffName), Collections.emptyList());
storeTotalOutput = storeTotalOutput.add(sumRowValuesAsBigDecimal(staffMonthRows, DailyReportFieldEnum.F2_58_4.getValue()));
}
List<Map<String, String>> result = new ArrayList<>();
for (Map<String, String> latestRow : latestRows) {
String staffName = latestRow.get(DailyReportFieldEnum.F2_58_1.getValue());
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!