|
|
@@ -939,6 +939,35 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
// 5. 将其他费用收入合并进结果集合
|
|
|
mergeOtherCostIncomeToResult(filterIncomeList, resultList, companyMap);
|
|
|
|
|
|
+ if (CollUtil.isEmpty(resultList)){
|
|
|
+ return resultList;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 按companyName分组,组内year+month升序,最后打平
|
|
|
+ resultList = resultList.stream()
|
|
|
+ // 按公司名称分组
|
|
|
+ .collect(Collectors.groupingBy(FollowCompanyFeeVO::getCompanyName))
|
|
|
+ // 获取分组后的value集合
|
|
|
+ .values()
|
|
|
+ .stream()
|
|
|
+ // 组内排序:先转数字,year升序,month升序
|
|
|
+ .map(group -> group.stream()
|
|
|
+ .sorted((o1, o2) -> {
|
|
|
+ // year、month字符串转Integer
|
|
|
+ int y1 = Integer.parseInt(o1.getYear());
|
|
|
+ int m1 = Integer.parseInt(o1.getMonth());
|
|
|
+ int y2 = Integer.parseInt(o2.getYear());
|
|
|
+ int m2 = Integer.parseInt(o2.getMonth());
|
|
|
+ if (y1 != y2) {
|
|
|
+ return Integer.compare(y1, y2);
|
|
|
+ }
|
|
|
+ return Integer.compare(m1, m2);
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList()))
|
|
|
+ // 将各个公司分组的list打平成一个大list
|
|
|
+ .flatMap(List::stream)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
return resultList;
|
|
|
}
|
|
|
|