|
|
@@ -30,6 +30,7 @@ import org.springblade.los.basic.business.entity.BusinessType;
|
|
|
import org.springblade.los.basic.business.service.IBusinessTypeService;
|
|
|
import org.springblade.los.basic.corps.entity.BCorps;
|
|
|
import org.springblade.los.basic.corps.service.IBCorpsService;
|
|
|
+import org.springblade.los.basic.cur.service.IBCurrencyService;
|
|
|
import org.springblade.los.billno.entity.BusinessBillNo;
|
|
|
import org.springblade.los.billno.service.IBusinessBillNoService;
|
|
|
import org.springblade.los.business.aea.entity.AeaBills;
|
|
|
@@ -97,6 +98,8 @@ public class AmendsServiceImpl extends ServiceImpl<AmendsMapper, Amends> impleme
|
|
|
|
|
|
private final AeaBillsMapper aeaBillsMapper;
|
|
|
|
|
|
+ private final IBCurrencyService bCurrencyService;
|
|
|
+
|
|
|
@Override
|
|
|
public IPage<AmendsVO> selectAmendsPage(IPage<AmendsVO> page, AmendsVO amends) {
|
|
|
return page.setRecords(baseMapper.selectAmendsPage(page, amends));
|
|
|
@@ -274,11 +277,36 @@ public class AmendsServiceImpl extends ServiceImpl<AmendsMapper, Amends> impleme
|
|
|
if (feeCenterList.isEmpty()) {
|
|
|
throw new RuntimeException("费用明细不能为空");
|
|
|
}
|
|
|
+ List<FeeCenter> feeCenterListUsd = feeCenterList.stream().filter(e -> "USD".equals(e.getCurCode())).collect(Collectors.toList());
|
|
|
+ List<FeeCenter> feeCenterListCny = feeCenterList.stream().filter(e -> "CNY".equals(e.getCurCode())).collect(Collectors.toList());
|
|
|
+ if (!feeCenterListUsd.isEmpty() && !feeCenterListCny.isEmpty()) {
|
|
|
+ throw new RuntimeException("应收应付币种不一致");
|
|
|
+ }
|
|
|
BigDecimal amountC = feeCenterList.stream().filter(e -> "C".equals(e.getDc())).map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
BigDecimal amountD = feeCenterList.stream().filter(e -> "D".equals(e.getDc())).map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
auditProecessDTO.setPayAmount(amountC);
|
|
|
auditProecessDTO.setReceivableAmount(amountD);
|
|
|
- auditProecessDTO.setGrossProfit(amountD.subtract(amountC));
|
|
|
+ BigDecimal amountCnyD = feeCenterList.stream()
|
|
|
+ .filter(e -> "CNY".equals(e.getCurCode()) && "D".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount)
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ BigDecimal amountCnyC = feeCenterList.stream()
|
|
|
+ .filter(e -> "CNY".equals(e.getCurCode()) && "C".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount)
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ BigDecimal amountUsdD = feeCenterList.stream()
|
|
|
+ .filter(e -> "USD".equals(e.getCurCode()) && "D".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount)
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ BigDecimal amountUsdC = feeCenterList.stream()
|
|
|
+ .filter(e -> "USD".equals(e.getCurCode()) && "C".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount)
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+
|
|
|
+ auditProecessDTO.setGrossProfit(amountCnyD.subtract(amountCnyC));
|
|
|
+ auditProecessDTO.setGrossProfitUsd(amountUsdD.subtract(amountUsdC));
|
|
|
+ auditProecessDTO.setGrossProfitLoc(auditProecessDTO.getGrossProfit().add(bCurrencyService.converterCny("USD", auditProecessDTO.getGrossProfitUsd(), "")));
|
|
|
+
|
|
|
auditProecessDTO.setSalesCompanyName(declare.getCreateDeptName());
|
|
|
List<FeeCenter> feeCenterBills = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
|
|
|
.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
|