|
|
@@ -1801,6 +1801,42 @@ public class KwcContractTradeService {
|
|
|
return tradeBaseInfo;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据贸易合同查询采购、供应及代理企业信息
|
|
|
+ */
|
|
|
+ public ContractTradeEntResp queryContractTradeEnt(Long contractId) {
|
|
|
+ KwcContractTrade kwcContractTrade = kwcContractTradeRepository.queryByContractId(contractId);
|
|
|
+ if (Objects.isNull(kwcContractTrade)) {
|
|
|
+ return new ContractTradeEntResp();
|
|
|
+ }
|
|
|
+ List<KwcContractTradeUnit> tradeUnits = kwcContractTradeUnitRepository.queryByContractId(contractId);
|
|
|
+ Map<Integer, KwcContractTradeUnit> unitTypeMap = CollectionUtils.isEmpty(tradeUnits)
|
|
|
+ ? Collections.emptyMap()
|
|
|
+ : tradeUnits.stream().collect(Collectors.toMap(KwcContractTradeUnit::getUnitType, Function.identity(), (v1, v2) -> v1));
|
|
|
+
|
|
|
+ ContractTradeEntResp resp = new ContractTradeEntResp();
|
|
|
+ resp.setContractId(kwcContractTrade.getId());
|
|
|
+ resp.setContractCode(kwcContractTrade.getContractNo());
|
|
|
+ resp.setContractName(kwcContractTrade.getName());
|
|
|
+ resp.setPurchaseEnt(toEntUnitInfo(unitTypeMap.get(CooperateTypeEnum.PURCHASER.getCode())));
|
|
|
+ resp.setProvideEnt(toEntUnitInfo(unitTypeMap.get(CooperateTypeEnum.SUPPLIER.getCode())));
|
|
|
+ resp.setAgentEnt(toEntUnitInfo(unitTypeMap.get(KwcContractTradeUnitService.TRADE_AGENT_UNIT_TYPE)));
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+ private static ContractTradeEntResp.EntUnitInfo toEntUnitInfo(KwcContractTradeUnit unit) {
|
|
|
+ if (Objects.isNull(unit) || Objects.isNull(unit.getEntId())) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ ContractTradeEntResp.EntUnitInfo entUnitInfo = new ContractTradeEntResp.EntUnitInfo();
|
|
|
+ entUnitInfo.setEntId(unit.getEntId());
|
|
|
+ entUnitInfo.setFirmName(unit.getFirmName());
|
|
|
+ entUnitInfo.setContacts(unit.getContacts());
|
|
|
+ entUnitInfo.setPhone(unit.getPhone());
|
|
|
+ entUnitInfo.setSignPhone(unit.getSignPhone());
|
|
|
+ return entUnitInfo;
|
|
|
+ }
|
|
|
+
|
|
|
public List<QueryListResVo> queryTradeListByPage(QueryTradeReq req) {
|
|
|
|
|
|
Long entId;
|