|
|
@@ -2900,12 +2900,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
Integer endYear = Integer.parseInt(searchYear.getSearch().split(",")[1]);
|
|
|
|
|
|
// 获取所有年份
|
|
|
- List<Integer> yearList = new ArrayList<>();
|
|
|
- if (startYear <= endYear) {
|
|
|
- for (int year = startYear; year <= endYear; year++) {
|
|
|
- yearList.add(year);
|
|
|
- }
|
|
|
- }
|
|
|
+ Map<String, List<Integer>> companyYearMap = new HashMap<>();
|
|
|
|
|
|
// 获取当前用户的系统编码
|
|
|
String systemCode = baseController.getUserSystemCode();
|
|
|
@@ -2949,42 +2944,30 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
}
|
|
|
return true;
|
|
|
};
|
|
|
- // 签单年份
|
|
|
- Predicate<InsPlyIncomeDto> signYearPredicate = insPlyIncome -> {
|
|
|
- if (!names.contains(FollowInvoicePageListVo.SearchVO.signYear)) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- FollowInvoicePageListVo.SearchVO searchVO = searchVOMap.get(FollowInvoicePageListVo.SearchVO.signYear);
|
|
|
- String type = searchVO.getType();
|
|
|
- String search = searchVO.getSearch();
|
|
|
- if ("为空".equals(type) || "不为空".equals(type)) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- if (StrUtil.isEmpty(search)) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- if ("等于".equalsIgnoreCase(type) || "包含".equalsIgnoreCase(type)) {
|
|
|
- List<String> signYears = Arrays.asList(search.split(","));
|
|
|
- return signYears.contains(insPlyIncome.getSignYear());
|
|
|
- }
|
|
|
- if ("不等于".equalsIgnoreCase(type) || "不包含".equalsIgnoreCase(type)) {
|
|
|
- List<String> signYears = Arrays.asList(search.split(","));
|
|
|
- return !signYears.contains(insPlyIncome.getSignYear());
|
|
|
- }
|
|
|
- return true;
|
|
|
- };
|
|
|
|
|
|
// AND / OR 组合逻辑(和代码A完全一致)
|
|
|
if ("and".equalsIgnoreCase(followInvoicePageListVo.getLogicJudge())) {
|
|
|
- Predicate<InsPlyIncomeDto> and = companyIdPredicate.and(signYearPredicate);
|
|
|
+ Predicate<InsPlyIncomeDto> and = companyIdPredicate;
|
|
|
filterIncomes = incomes.stream().filter(and).toList();
|
|
|
} else if ("or".equalsIgnoreCase(followInvoicePageListVo.getLogicJudge())) {
|
|
|
- Predicate<InsPlyIncomeDto> or = companyIdPredicate.or(signYearPredicate);
|
|
|
+ Predicate<InsPlyIncomeDto> or = companyIdPredicate;
|
|
|
filterIncomes = incomes.stream().filter(or).toList();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
// ======================条件过滤结束======================
|
|
|
+ for (InsPlyIncomeDto filterIncome : filterIncomes) {
|
|
|
+ List<Integer> years = companyYearMap.get(filterIncome.getPartnerCompanyId());
|
|
|
+ // 否则新建
|
|
|
+ if (CollUtil.isEmpty(years)) {
|
|
|
+ years = new ArrayList<>();
|
|
|
+ }
|
|
|
+ // 如果不包含当前公司id的年份,则添加
|
|
|
+ if (!years.contains(filterIncome.getSigningTime().getYear())) {
|
|
|
+ years.add(filterIncome.getSigningTime().getYear());
|
|
|
+ }
|
|
|
+ companyYearMap.put(filterIncome.getPartnerCompanyId(), years);
|
|
|
+ }
|
|
|
|
|
|
// 按合作方分组(使用过滤后的数据)
|
|
|
Map<String, List<InsPlyIncomeDto>> groupMap = filterIncomes.stream()
|
|
|
@@ -3009,6 +2992,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
|
|
|
// 遍历12个月份,组装VO对象
|
|
|
InsPlyIncomeDto firstItem = list.get(0);
|
|
|
+ List<Integer> yearList = companyYearMap.get(partnerCompanyId);
|
|
|
for (Integer year : yearList) {
|
|
|
for (int month = 1; month <= 12; month++) {
|
|
|
InsFeeFollowOrderVo vo = buildFollowOrderVo(
|