|
|
@ -1,6 +1,8 @@ |
|
|
|
package com.ruoyi.system.service.impl; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
import com.github.pagehelper.Page; |
|
|
|
import com.ruoyi.common.core.domain.entity.SysUser; |
|
|
@ -495,19 +497,35 @@ public class OutsourceOrderServiceImpl implements IOutsourceOrderService |
|
|
|
throw new BusinessException("委外订单详情为空!"); |
|
|
|
} |
|
|
|
int rows = 0; |
|
|
|
for (OutsourceOrderDetail detail : orderDetails) { |
|
|
|
Map<String, OutsourceOrderDetail> merged = orderDetails.stream() |
|
|
|
.collect(Collectors.toMap( |
|
|
|
OutsourceOrderDetail::getSupplierCode, |
|
|
|
detail -> detail, |
|
|
|
(existing, replacement) -> { |
|
|
|
existing.setRmbSum(existing.getRmbSum().add(replacement.getRmbSum())); |
|
|
|
existing.setNoRmbSum(existing.getNoRmbSum().add(replacement.getNoRmbSum())); |
|
|
|
existing.setActualOutsourceAmount(existing.getActualOutsourceAmount() + replacement.getActualOutsourceAmount()); |
|
|
|
return existing; |
|
|
|
} |
|
|
|
)); |
|
|
|
List<OutsourceOrderDetail> resultList = new ArrayList<>(merged.values()); |
|
|
|
for (OutsourceOrderDetail detail : resultList) { |
|
|
|
FinancialAccountsPayable financialPayable = new FinancialAccountsPayable(); |
|
|
|
financialPayable.setAccountsPayableCode(redisCache.generateBillNo("YF")); |
|
|
|
financialPayable.setAccountsPayableStatus("0"); |
|
|
|
financialPayable.setStorageStatus("0"); |
|
|
|
financialPayable.setRelevanceCode(detail.getOutsourceOrderNo()); |
|
|
|
financialPayable.setPriceIncludesTax(detail.getRmbSum()); |
|
|
|
financialPayable.setPriceExcludingTax(detail.getNoRmbSum()); |
|
|
|
financialPayable.setActualPaidPrice(BigDecimal.ZERO); |
|
|
|
financialPayable.setUnpaidPrice(detail.getRmbSum()); |
|
|
|
financialPayable.setCurrencyType("1"); |
|
|
|
financialPayable.setSupplierCode(detail.getSupplierCode()); |
|
|
|
financialPayable.setSupplierName(detail.getSupplierName()); |
|
|
|
SysSupplier supplier = supplierMapper.selectSysSupplierByCode(detail.getSupplierCode()); |
|
|
|
financialPayable.setOpenAccount(supplier.getBankAccount()); |
|
|
|
financialPayable.setOpenBank(supplier.getDepositBank()); |
|
|
|
financialPayable.setPriceExcludingTax(detail.getRmbSum()); |
|
|
|
financialPayable.setPriceExcludingTax(detail.getNoRmbSum()); |
|
|
|
financialPayable.setPaymentCondition(supplier.getPaymentTerms()); |
|
|
|
financialPayable.setPurchaseBuyer(outsourceOrder.getOutsourceStaff()); |
|
|
|
financialPayable.setCreateBy(ShiroUtils.getLoginName()); |
|
|
|
financialPayable.setCreateTime(DateUtils.getNowDate()); |
|
|
|