|
|
@@ -573,13 +573,14 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
queryWrapper.lambda().eq(InsPlyFollowInvoiceLink::getIsDelete, 0);
|
|
|
List<InsPlyFollowInvoiceLink> insPlyFollowInvoiceLinks = insPlyFollowInvoiceLinkMapper.selectList(queryWrapper);
|
|
|
|
|
|
- if (CollUtil.isNotEmpty(insPlyFollowInvoiceLinks)){
|
|
|
- List<String> ids = insPlyFollowInvoiceLinks.stream().map(InsPlyFollowInvoiceLink::getId).toList();
|
|
|
- List<String> followIds = insPlyFollowInvoiceLinks.stream().map(InsPlyFollowInvoiceLink::getFollowId).toList();
|
|
|
- insPlyFollowInvoiceLinkMapper.deleteByIds(ids);
|
|
|
- return insFeeFollowOrderMapper.deleteByIds(followIds) > 0;
|
|
|
+ if (CollUtil.isEmpty(insPlyFollowInvoiceLinks)){
|
|
|
+ return false;
|
|
|
}
|
|
|
- return Boolean.FALSE;
|
|
|
+ List<String> ids = insPlyFollowInvoiceLinks.stream().map(InsPlyFollowInvoiceLink::getId).toList();
|
|
|
+ List<String> followIds = insPlyFollowInvoiceLinks.stream().map(InsPlyFollowInvoiceLink::getFollowId).toList();
|
|
|
+ insPlyFollowInvoiceLinkMapper.deleteByIds(ids);
|
|
|
+ insFeeFollowOrderMapper.deleteByIds(followIds);
|
|
|
+ return insPlyIncomeInvoiceMapper.deleteById(invoiceId) > 0;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -1631,20 +1632,20 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
.set(InsPlyIncomeInvoice::getStatus,"0").eq(InsPlyIncomeInvoice::getId,invoiceId));
|
|
|
|
|
|
// 查询中间表:使用 QueryWrapper,增加逻辑删除过滤
|
|
|
- LambdaQueryWrapper<InsPlyFollowInvoiceLink> linkQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
- linkQueryWrapper.eq(InsPlyFollowInvoiceLink::getInvoiceId, invoiceId);
|
|
|
- linkQueryWrapper.eq(InsPlyFollowInvoiceLink::getIsDelete, SETTLE_STATUS_RESET);
|
|
|
- List<InsPlyFollowInvoiceLink> linkList = insPlyFollowInvoiceLinkMapper.selectList(linkQueryWrapper);
|
|
|
-
|
|
|
- if (CollUtil.isNotEmpty(linkList)){
|
|
|
- // 删除中间表
|
|
|
- List<String> followLinkIds = linkList.stream().map(InsPlyFollowInvoiceLink::getId).collect(Collectors.toList());
|
|
|
- insPlyFollowInvoiceLinkMapper.deleteByIds(followLinkIds);
|
|
|
-
|
|
|
- // 删除跟单表
|
|
|
- List<String> followIds = linkList.stream().map(InsPlyFollowInvoiceLink::getFollowId).collect(Collectors.toList());
|
|
|
- insFeeFollowOrderMapper.deleteByIds(followIds);
|
|
|
- }
|
|
|
+// LambdaQueryWrapper<InsPlyFollowInvoiceLink> linkQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+// linkQueryWrapper.eq(InsPlyFollowInvoiceLink::getInvoiceId, invoiceId);
|
|
|
+// linkQueryWrapper.eq(InsPlyFollowInvoiceLink::getIsDelete, SETTLE_STATUS_RESET);
|
|
|
+// List<InsPlyFollowInvoiceLink> linkList = insPlyFollowInvoiceLinkMapper.selectList(linkQueryWrapper);
|
|
|
+
|
|
|
+// if (CollUtil.isNotEmpty(linkList)){
|
|
|
+// // 删除中间表
|
|
|
+// List<String> followLinkIds = linkList.stream().map(InsPlyFollowInvoiceLink::getId).collect(Collectors.toList());
|
|
|
+// insPlyFollowInvoiceLinkMapper.deleteByIds(followLinkIds);
|
|
|
+//
|
|
|
+// // 删除跟单表
|
|
|
+// List<String> followIds = linkList.stream().map(InsPlyFollowInvoiceLink::getFollowId).collect(Collectors.toList());
|
|
|
+// insFeeFollowOrderMapper.deleteByIds(followIds);
|
|
|
+// }
|
|
|
return insPlyIncomeInvoiceSettlementMapper.deleteById(id) > 0;
|
|
|
}
|
|
|
|
|
|
@@ -2900,12 +2901,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 +2945,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 +2993,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(
|
|
|
@@ -3228,7 +3213,12 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
invoiceRecordQueryVo.setSettlementStatus(null);
|
|
|
}
|
|
|
invoiceRecordQueryVo.setSystemCode(baseController.getSystemCode());
|
|
|
- Page<InvoiceRecordResult> invoiceRecordList = baseMapper.getInvoiceRecordList(invoiceRecordQueryVo.getPage(), invoiceRecordQueryVo);
|
|
|
+ Page<InvoiceRecordResult> invoiceRecordList = null;
|
|
|
+ if ("2".equals(invoiceRecordQueryVo.getInvoiceType())){
|
|
|
+ invoiceRecordList = baseMapper.getFollowInvoiceRecordList(invoiceRecordQueryVo.getPage(), invoiceRecordQueryVo);
|
|
|
+ }else if ("1".equals(invoiceRecordQueryVo.getInvoiceType())){
|
|
|
+ invoiceRecordList = baseMapper.getInvoiceRecordList(invoiceRecordQueryVo.getPage(), invoiceRecordQueryVo);
|
|
|
+ }
|
|
|
List<InvoiceRecordResult> records = invoiceRecordList.getRecords();
|
|
|
if(CollUtil.isNotEmpty(records)){
|
|
|
Map<String, String> allCompanyHierarchyPaths = esmInsCompanyClient.getAllCompanyHierarchyPaths();
|