|
@@ -219,11 +219,7 @@ public class TqContractServiceImpl implements ITqContractService
|
|
|
));
|
|
|
//将合同的初始version设置为1
|
|
|
tqContractDto.setVersion(1L);
|
|
|
- Map<Long, BigDecimal> idAndRateMap = tbContractCurrencyService.selectExchangeRateByCurrencyId(contractCurrencyTimeList);
|
|
|
- //将签单币种汇率赋值
|
|
|
- if(idAndRateMap.containsKey(Long.parseLong(tqContractDto.getCurrencyId()))){
|
|
|
- tqContractDto.setRate4SigningContracts(idAndRateMap.get((Long.parseLong(tqContractDto.getCurrencyId()))));
|
|
|
- }
|
|
|
+
|
|
|
//将合同的
|
|
|
tqContractMapper.insertTqContract(tqContractDto);
|
|
|
//附件上传
|
|
@@ -348,6 +344,7 @@ public class TqContractServiceImpl implements ITqContractService
|
|
|
))
|
|
|
.collect(Collectors.toList());
|
|
|
Map<Long, BigDecimal> scheduleListIdAndRateMap = tbContractCurrencyService.selectExchangeRateByCurrencyId(scheduleList);
|
|
|
+
|
|
|
//根据实际发货排产日期查询汇率
|
|
|
List<ContractCurrencyTime> deliveryList = tqContractLiftList.stream().filter(tqContractLift -> tqContractLift.getActualDeliveryDate() != null) // Filter out null signing dates
|
|
|
.map(tqContractLift -> new ContractCurrencyTime(
|
|
@@ -356,6 +353,15 @@ public class TqContractServiceImpl implements ITqContractService
|
|
|
.collect(Collectors.toList());
|
|
|
Map<Long, BigDecimal> deliveryListIdAndRateMap = tbContractCurrencyService.selectExchangeRateByCurrencyId(deliveryList);
|
|
|
|
|
|
+
|
|
|
+ //根据签单日期查询汇率
|
|
|
+ List<ContractCurrencyTime> signingDateList = tqContractLiftList.stream()
|
|
|
+ .map(tqContractLift -> new ContractCurrencyTime(
|
|
|
+ Long.parseLong(tqContractLift.getCurrencyId()), tqContractDto.getSigningDate()
|
|
|
+ ))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ Map<Long, BigDecimal> signingDateListIdAndRateMap = tbContractCurrencyService.selectExchangeRateByCurrencyId(signingDateList);
|
|
|
+
|
|
|
tqContractLiftList.forEach(item -> {
|
|
|
item.setContractNo(tqContractDto.getContractNo());
|
|
|
item.setContractName(tqContractDto.getContractName());
|
|
@@ -374,7 +380,6 @@ public class TqContractServiceImpl implements ITqContractService
|
|
|
item.setPaymentRatio(tqContractDto.getPaymentRatio());
|
|
|
item.setContractNoVersionNo(tqContractDto.getContractNo()+"-"+tqContractDto.getVersion());
|
|
|
item.setPermissionChar(SecurityUtils.getPermissionCharIns());
|
|
|
- item.setRate4SigningContracts(tqContractDto.getRate4SigningContracts());
|
|
|
item.setType(tqContractDto.getType());
|
|
|
//将签单币种汇率赋值
|
|
|
if(scheduleListIdAndRateMap.containsKey(Long.parseLong(item.getCurrencyId()))){
|
|
@@ -384,6 +389,10 @@ public class TqContractServiceImpl implements ITqContractService
|
|
|
if(deliveryListIdAndRateMap.containsKey(Long.parseLong(item.getCurrencyId()))){
|
|
|
item.setRate4Shipment(deliveryListIdAndRateMap.get(Long.parseLong(item.getCurrencyId())));
|
|
|
}
|
|
|
+ //签单汇率
|
|
|
+ if(signingDateListIdAndRateMap.containsKey(Long.parseLong(item.getCurrencyId()))){
|
|
|
+ item.setRate4SigningContracts(signingDateListIdAndRateMap.get(Long.parseLong(item.getCurrencyId())));
|
|
|
+ }
|
|
|
});
|
|
|
return tqContractLiftList;
|
|
|
}
|