|
@@ -202,6 +202,7 @@ public class KwcContractTradeService {
|
|
|
queryTradeReq.setSupplementCode(reqVo.getSupplementCode());
|
|
queryTradeReq.setSupplementCode(reqVo.getSupplementCode());
|
|
|
queryTradeReq.setPurchaseEntId(reqVo.getPurchaseEntId());
|
|
queryTradeReq.setPurchaseEntId(reqVo.getPurchaseEntId());
|
|
|
queryTradeReq.setSupplyEntId(reqVo.getSupplyEntId());
|
|
queryTradeReq.setSupplyEntId(reqVo.getSupplyEntId());
|
|
|
|
|
+ queryTradeReq.setAgentEntId(reqVo.getAgentEntId());
|
|
|
queryTradeReq.setDispatchWay(reqVo.getDispatchWay());
|
|
queryTradeReq.setDispatchWay(reqVo.getDispatchWay());
|
|
|
queryTradeReq.setStatus(reqVo.getStatus());
|
|
queryTradeReq.setStatus(reqVo.getStatus());
|
|
|
queryTradeReq.setAgentFlag(reqVo.getAgentFlag());
|
|
queryTradeReq.setAgentFlag(reqVo.getAgentFlag());
|
|
@@ -1738,6 +1739,9 @@ public class KwcContractTradeService {
|
|
|
entIds.add(Long.valueOf(req.getSupplyEntId()));
|
|
entIds.add(Long.valueOf(req.getSupplyEntId()));
|
|
|
//type = CooperateTypeEnum.SUPPLIER.getCode();
|
|
//type = CooperateTypeEnum.SUPPLIER.getCode();
|
|
|
}
|
|
}
|
|
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isNotBlank(req.getAgentEntId())) {
|
|
|
|
|
+ entIds.add(Long.valueOf(req.getAgentEntId()));
|
|
|
|
|
+ }
|
|
|
Set<Long> contractIds = buildTradeQueryContractIds(entId, req, entIds);
|
|
Set<Long> contractIds = buildTradeQueryContractIds(entId, req, entIds);
|
|
|
if (org.apache.commons.collections4.CollectionUtils.isEmpty(contractIds)) {
|
|
if (org.apache.commons.collections4.CollectionUtils.isEmpty(contractIds)) {
|
|
|
return Collections.emptyList();
|
|
return Collections.emptyList();
|
|
@@ -1874,6 +1878,11 @@ public class KwcContractTradeService {
|
|
|
.filter(x -> org.apache.commons.lang3.StringUtils.equals(x.getProvideEntId(), req.getSupplyEntId()))
|
|
.filter(x -> org.apache.commons.lang3.StringUtils.equals(x.getProvideEntId(), req.getSupplyEntId()))
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
}
|
|
}
|
|
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isNotBlank(req.getAgentEntId())) {
|
|
|
|
|
+ queryListResVos = queryListResVos.stream()
|
|
|
|
|
+ .filter(x -> org.apache.commons.lang3.StringUtils.equals(x.getAgentEntId(), req.getAgentEntId()))
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+ }
|
|
|
return queryListResVos.stream()
|
|
return queryListResVos.stream()
|
|
|
.sorted(Comparator.comparing(QueryListResVo::getUpdateTime).reversed()
|
|
.sorted(Comparator.comparing(QueryListResVo::getUpdateTime).reversed()
|
|
|
.thenComparing(Comparator.comparing(QueryListResVo::getId).reversed()))
|
|
.thenComparing(Comparator.comparing(QueryListResVo::getId).reversed()))
|
|
@@ -1959,6 +1968,22 @@ public class KwcContractTradeService {
|
|
|
log.debug("供应方过滤后剩余合同数量: {} (原数量: {})", contractIds.size(), beforeSize);
|
|
log.debug("供应方过滤后剩余合同数量: {} (原数量: {})", contractIds.size(), beforeSize);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isNotBlank(req.getAgentEntId())) {
|
|
|
|
|
+ Long agentEntId = Long.valueOf(req.getAgentEntId());
|
|
|
|
|
+ log.debug("应用代理单位过滤条件: agentEntId = {}", agentEntId);
|
|
|
|
|
+
|
|
|
|
|
+ Set<Long> agentContractIds = units.stream()
|
|
|
|
|
+ .filter(unit -> Objects.equals(unit.getEntId(), agentEntId))
|
|
|
|
|
+ .filter(unit -> Objects.equals(unit.getUnitType(), CooperateTypeEnum.SUPPLIER.getCode()))
|
|
|
|
|
+ .map(KwcContractTradeUnit::getContractId)
|
|
|
|
|
+ .filter(Objects::nonNull)
|
|
|
|
|
+ .collect(Collectors.toSet());
|
|
|
|
|
+
|
|
|
|
|
+ int beforeSize = contractIds.size();
|
|
|
|
|
+ contractIds.retainAll(agentContractIds);
|
|
|
|
|
+ log.debug("代理单位过滤后剩余合同数量: {} (原数量: {})", contractIds.size(), beforeSize);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
log.info("最终构建的合同ID集合大小: {}, entId: {}, purchaseEntId: {}, supplyEntId: {}",
|
|
log.info("最终构建的合同ID集合大小: {}, entId: {}, purchaseEntId: {}, supplyEntId: {}",
|
|
|
contractIds.size(), entId, req.getPurchaseEntId(), req.getSupplyEntId());
|
|
contractIds.size(), entId, req.getPurchaseEntId(), req.getSupplyEntId());
|
|
|
return contractIds;
|
|
return contractIds;
|
|
@@ -1979,6 +2004,9 @@ public class KwcContractTradeService {
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(req.getSupplyEntId())) {
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(req.getSupplyEntId())) {
|
|
|
entIds.add(Long.valueOf(req.getSupplyEntId()));
|
|
entIds.add(Long.valueOf(req.getSupplyEntId()));
|
|
|
}
|
|
}
|
|
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isNotBlank(req.getAgentEntId())) {
|
|
|
|
|
+ entIds.add(Long.valueOf(req.getAgentEntId()));
|
|
|
|
|
+ }
|
|
|
Set<Long> contractIds = buildTradeQueryContractIds(entId, req, entIds);
|
|
Set<Long> contractIds = buildTradeQueryContractIds(entId, req, entIds);
|
|
|
if (org.apache.commons.collections4.CollectionUtils.isEmpty(contractIds)) {
|
|
if (org.apache.commons.collections4.CollectionUtils.isEmpty(contractIds)) {
|
|
|
return 0L;
|
|
return 0L;
|
|
@@ -2038,7 +2066,8 @@ public class KwcContractTradeService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(req.getPurchaseEntId())
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(req.getPurchaseEntId())
|
|
|
- || org.apache.commons.lang3.StringUtils.isNotBlank(req.getSupplyEntId())) {
|
|
|
|
|
|
|
+ || org.apache.commons.lang3.StringUtils.isNotBlank(req.getSupplyEntId())
|
|
|
|
|
+ || org.apache.commons.lang3.StringUtils.isNotBlank(req.getAgentEntId())) {
|
|
|
Set<Long> tradeContractIds = records.stream().map(KwcContractTrade::getId).collect(Collectors.toSet());
|
|
Set<Long> tradeContractIds = records.stream().map(KwcContractTrade::getId).collect(Collectors.toSet());
|
|
|
List<KwcContractTradeUnit> tradeUnits = kwcContractTradeUnitRepository.queryByContractIds(tradeContractIds);
|
|
List<KwcContractTradeUnit> tradeUnits = kwcContractTradeUnitRepository.queryByContractIds(tradeContractIds);
|
|
|
Map<String, KwcContractTradeUnit> contractUnitTypeKeyAndUnitMap = Maps.newHashMap();
|
|
Map<String, KwcContractTradeUnit> contractUnitTypeKeyAndUnitMap = Maps.newHashMap();
|
|
@@ -2065,6 +2094,14 @@ public class KwcContractTradeService {
|
|
|
return org.apache.commons.lang3.StringUtils.equals(String.valueOf(provideEnt.getEntId()), req.getSupplyEntId());
|
|
return org.apache.commons.lang3.StringUtils.equals(String.valueOf(provideEnt.getEntId()), req.getSupplyEntId());
|
|
|
}).collect(Collectors.toList());
|
|
}).collect(Collectors.toList());
|
|
|
}
|
|
}
|
|
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isNotBlank(req.getAgentEntId())) {
|
|
|
|
|
+ records = records.stream().filter(record -> {
|
|
|
|
|
+ KwcContractTradeUnit provideEnt =
|
|
|
|
|
+ finalContractUnitTypeKeyAndUnitMap.getOrDefault(record.getId() + "-" + CooperateTypeEnum.SUPPLIER.getCode(),
|
|
|
|
|
+ new KwcContractTradeUnit());
|
|
|
|
|
+ return org.apache.commons.lang3.StringUtils.equals(String.valueOf(provideEnt.getEntId()), req.getAgentEntId());
|
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
return records.size();
|
|
return records.size();
|
|
|
}
|
|
}
|
|
@@ -2123,6 +2160,10 @@ public class KwcContractTradeService {
|
|
|
new KwcContractTradeUnit());
|
|
new KwcContractTradeUnit());
|
|
|
queryListResVo.setProvideEntId(String.valueOf(provideEnt.getEntId()));
|
|
queryListResVo.setProvideEntId(String.valueOf(provideEnt.getEntId()));
|
|
|
queryListResVo.setProvideEntName(provideEnt.getFirmName());
|
|
queryListResVo.setProvideEntName(provideEnt.getFirmName());
|
|
|
|
|
+ if (Objects.equals(t.getAgentFlag(), Global.YES)) {
|
|
|
|
|
+ queryListResVo.setAgentEntId(String.valueOf(provideEnt.getEntId()));
|
|
|
|
|
+ queryListResVo.setAgentEntName(provideEnt.getFirmName());
|
|
|
|
|
+ }
|
|
|
//queryListResVo.setCheckedEntName();
|
|
//queryListResVo.setCheckedEntName();
|
|
|
queryListResVo.setContractNo(t.getContractNo());
|
|
queryListResVo.setContractNo(t.getContractNo());
|
|
|
queryListResVo.setContractName(t.getName());
|
|
queryListResVo.setContractName(t.getName());
|