|
@@ -1115,9 +1115,12 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
throw new BizException("商品信息不存在");
|
|
|
}
|
|
|
String orderNo = "Y" + idGeneratorService.generatorId("payment");
|
|
|
+ //获取账期金额
|
|
|
+ List<MusicGroupCalenderRefundPeriod> refundPeriods = musicGroupCalenderRefundPeriodService.findByCalenderId(calender.getId());
|
|
|
+ BigDecimal totalAmount = refundPeriods.stream().map(e -> e.getRefundAmount()).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
//管乐迷应收订单创建
|
|
|
StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
|
|
|
- studentPaymentOrder.setActualAmount(calender.getCurrentTotalAmount());
|
|
|
+ studentPaymentOrder.setActualAmount(totalAmount);
|
|
|
studentPaymentOrder.setCooperationId(musicGroup.getCooperationOrganId());
|
|
|
studentPaymentOrder.setMusicGroupId(calender.getMusicGroupId());
|
|
|
studentPaymentOrder.setCalenderId(calender.getId());
|
|
@@ -1125,7 +1128,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
studentPaymentOrder.setGroupType(GroupType.OUTORDER);
|
|
|
studentPaymentOrder.setOrganId(musicGroup.getOrganId());
|
|
|
studentPaymentOrder.setRoutingOrganId(musicGroup.getOrganId());
|
|
|
- studentPaymentOrder.setExpectAmount(calender.getCurrentTotalAmount());
|
|
|
+ studentPaymentOrder.setExpectAmount(totalAmount);
|
|
|
studentPaymentOrder.setStatus(DealStatusEnum.SUCCESS);
|
|
|
studentPaymentOrder.setCreateTime(date);
|
|
|
studentPaymentOrder.setUpdateTime(date);
|
|
@@ -1162,7 +1165,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
//获取比例
|
|
|
BigDecimal totalProportion = BigDecimal.ZERO;
|
|
|
if(studentPaymentOrder.getExpectAmount().compareTo(BigDecimal.ZERO) > 0){
|
|
|
- totalProportion = calenderGood.getTotalPrice().divide(originalTotalAmount, 6, RoundingMode.DOWN);
|
|
|
+ totalProportion = calenderGood.getTotalPrice().divide(originalTotalAmount, 16, RoundingMode.DOWN);
|
|
|
}
|
|
|
//获取现价
|
|
|
BigDecimal currentTotalAmount;
|
|
@@ -1194,7 +1197,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
//获取比例
|
|
|
BigDecimal proportion = BigDecimal.ZERO;
|
|
|
if (totalCostPrice.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
- proportion = goodsDto.getOrganCostPrice().divide(totalCostPrice, 6, RoundingMode.DOWN);
|
|
|
+ proportion = goodsDto.getOrganCostPrice().divide(totalCostPrice, 16, RoundingMode.DOWN);
|
|
|
}
|
|
|
SellOrder sellOrder = new SellOrder();
|
|
|
sellOrder.setGoodsSkuId(goodsDto.getSkuStockId());
|
|
@@ -1245,7 +1248,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
//获取比例
|
|
|
BigDecimal proportion = BigDecimal.ZERO;
|
|
|
if (totalCostPrice.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
- proportion = sellOrder.getExpectAmount().divide(totalCostPrice, 6, RoundingMode.DOWN);
|
|
|
+ proportion = sellOrder.getExpectAmount().divide(totalCostPrice, 16, RoundingMode.DOWN);
|
|
|
}
|
|
|
if (i == sellOrderList.size() - 1) {
|
|
|
sellOrder.setOrderAmount(waitAmount);
|
|
@@ -1304,7 +1307,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
orderItemCreate.setRealAmount(waitRemitFee);
|
|
|
} else {
|
|
|
//获取比例
|
|
|
- BigDecimal ratioAmount = goodsDto.getOrganCostPrice().divide(totalAmount, 6, RoundingMode.DOWN);
|
|
|
+ BigDecimal ratioAmount = goodsDto.getOrganCostPrice().divide(totalAmount, 16, RoundingMode.DOWN);
|
|
|
//获取分配的金额
|
|
|
BigDecimal multiply = ratioAmount.multiply(totalPrice).setScale(2, RoundingMode.DOWN);
|
|
|
orderItemCreate.setRealAmount(multiply);
|