|
@@ -20,13 +20,16 @@ import com.fjhx.common.entity.currency.po.CurrencyRate;
|
|
import com.fjhx.common.enums.FlowStatusEnum1;
|
|
import com.fjhx.common.enums.FlowStatusEnum1;
|
|
import com.fjhx.common.service.currency.CurrencyRateService;
|
|
import com.fjhx.common.service.currency.CurrencyRateService;
|
|
import com.fjhx.customer.service.customer.CustomerService;
|
|
import com.fjhx.customer.service.customer.CustomerService;
|
|
|
|
+import com.fjhx.purchase.entity.pay.po.Pay;
|
|
import com.fjhx.purchase.entity.purchase.enums.PurchaseStatusEnum;
|
|
import com.fjhx.purchase.entity.purchase.enums.PurchaseStatusEnum;
|
|
import com.fjhx.purchase.entity.purchase.po.Purchase;
|
|
import com.fjhx.purchase.entity.purchase.po.Purchase;
|
|
|
|
+import com.fjhx.purchase.service.pay.PayDetailService;
|
|
import com.fjhx.purchase.service.purchase.PurchaseDetailService;
|
|
import com.fjhx.purchase.service.purchase.PurchaseDetailService;
|
|
import com.fjhx.purchase.service.purchase.PurchaseService;
|
|
import com.fjhx.purchase.service.purchase.PurchaseService;
|
|
import com.fjhx.sale.entity.claim.po.ClaimContract;
|
|
import com.fjhx.sale.entity.claim.po.ClaimContract;
|
|
import com.fjhx.sale.entity.contract.bo.ContractCurrencyRate;
|
|
import com.fjhx.sale.entity.contract.bo.ContractCurrencyRate;
|
|
import com.fjhx.sale.entity.contract.po.Contract;
|
|
import com.fjhx.sale.entity.contract.po.Contract;
|
|
|
|
+import com.fjhx.sale.entity.purchase.po.EhsdPurchase;
|
|
import com.fjhx.sale.entity.statement.dto.ProfitSettlementDto;
|
|
import com.fjhx.sale.entity.statement.dto.ProfitSettlementDto;
|
|
import com.fjhx.sale.entity.statement.vo.ProfitSettlementVo;
|
|
import com.fjhx.sale.entity.statement.vo.ProfitSettlementVo;
|
|
import com.fjhx.sale.service.claim.ClaimContractService;
|
|
import com.fjhx.sale.service.claim.ClaimContractService;
|
|
@@ -68,6 +71,9 @@ public class SaleStatementServiceImpl implements SaleStatementService {
|
|
private AccountRunningWaterService accountRunningWaterService;
|
|
private AccountRunningWaterService accountRunningWaterService;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
|
+ private PayDetailService payDetailService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
private ClaimService claimService;
|
|
private ClaimService claimService;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -311,7 +317,9 @@ public class SaleStatementServiceImpl implements SaleStatementService {
|
|
* 处理采购金额
|
|
* 处理采购金额
|
|
*/
|
|
*/
|
|
List<Purchase> pList = purchaseMap.getOrDefault(p.getContractId(), null);
|
|
List<Purchase> pList = purchaseMap.getOrDefault(p.getContractId(), null);
|
|
|
|
+ List<Long> purchaseIds = pList.stream().map(Purchase::getId).collect(Collectors.toList());
|
|
if (CollectionUtils.isNotEmpty(pList)) {
|
|
if (CollectionUtils.isNotEmpty(pList)) {
|
|
|
|
+
|
|
BigDecimal purchaseAmount = pList.stream().map(purchase -> {
|
|
BigDecimal purchaseAmount = pList.stream().map(purchase -> {
|
|
//获取汇率
|
|
//获取汇率
|
|
BigDecimal rate = assignCurrencyRatesMap.getOrDefault(purchase.getCurrency(), BigDecimal.ONE);
|
|
BigDecimal rate = assignCurrencyRatesMap.getOrDefault(purchase.getCurrency(), BigDecimal.ONE);
|
|
@@ -323,6 +331,21 @@ public class SaleStatementServiceImpl implements SaleStatementService {
|
|
p.setPurchaseAmount(purchaseAmount);
|
|
p.setPurchaseAmount(purchaseAmount);
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
|
|
+ * 处理支付款金额
|
|
|
|
+ */
|
|
|
|
+ List<Pay> payList = payDetailService.getSumMoney(purchaseIds);
|
|
|
|
+ if (CollectionUtils.isNotEmpty(payList)) {
|
|
|
|
+ BigDecimal payAmount = payList.stream().map(pay -> {
|
|
|
|
+ //获取汇率
|
|
|
|
+ BigDecimal rate = assignCurrencyRatesMap.getOrDefault(pay.getCurrency(), BigDecimal.ONE);
|
|
|
|
+ // 获取认领金额
|
|
|
|
+ BigDecimal money = pay.getAmount();
|
|
|
|
+ // 返回兑人民币后金额
|
|
|
|
+ return rate.multiply(money);
|
|
|
|
+ }).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
+ p.setAccountPaid(payAmount);
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
* 其他收入金额
|
|
* 其他收入金额
|
|
*/
|
|
*/
|
|
List<AccountRequestFundsDetailVo> accountRequestFundsDetailVos = accountRequestFundsDetailService.getListByContractId(p.getContractId());
|
|
List<AccountRequestFundsDetailVo> accountRequestFundsDetailVos = accountRequestFundsDetailService.getListByContractId(p.getContractId());
|
|
@@ -376,6 +399,7 @@ public class SaleStatementServiceImpl implements SaleStatementService {
|
|
* 处理采购金额
|
|
* 处理采购金额
|
|
*/
|
|
*/
|
|
List<Purchase> pList = purchaseMap.getOrDefault(p.getContractId(), null);
|
|
List<Purchase> pList = purchaseMap.getOrDefault(p.getContractId(), null);
|
|
|
|
+ List<Long> purchaseIds = pList.stream().map(Purchase::getId).collect(Collectors.toList());
|
|
if (CollectionUtils.isNotEmpty(pList)) {
|
|
if (CollectionUtils.isNotEmpty(pList)) {
|
|
BigDecimal purchaseAmount = pList.stream().map(purchase -> {
|
|
BigDecimal purchaseAmount = pList.stream().map(purchase -> {
|
|
//获取汇率
|
|
//获取汇率
|
|
@@ -388,6 +412,21 @@ public class SaleStatementServiceImpl implements SaleStatementService {
|
|
p.setPurchaseAmount(purchaseAmount);
|
|
p.setPurchaseAmount(purchaseAmount);
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
|
|
+ * 处理支付款金额
|
|
|
|
+ */
|
|
|
|
+ List<Pay> payList = payDetailService.getSumMoney(purchaseIds);
|
|
|
|
+ if (CollectionUtils.isNotEmpty(payList)) {
|
|
|
|
+ BigDecimal payAmount = payList.stream().map(pay -> {
|
|
|
|
+ //获取汇率
|
|
|
|
+ BigDecimal rate = pay.getRate()==null?BigDecimal.ONE:pay.getRate();
|
|
|
|
+ // 获取认领金额
|
|
|
|
+ BigDecimal money = pay.getAmount();
|
|
|
|
+ // 返回兑人民币后金额
|
|
|
|
+ return rate.multiply(money);
|
|
|
|
+ }).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
+ p.setAccountPaid(payAmount);
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
* 其他收入金额
|
|
* 其他收入金额
|
|
*/
|
|
*/
|
|
List<AccountRequestFundsDetailVo> accountRequestFundsDetailVos = accountRequestFundsDetailService.getListByContractId(p.getContractId());
|
|
List<AccountRequestFundsDetailVo> accountRequestFundsDetailVos = accountRequestFundsDetailService.getListByContractId(p.getContractId());
|