|
|
@@ -92,6 +92,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
private SysUserFeignService sysUserFeignService;
|
|
|
@Autowired
|
|
|
private RedisCache<String, Object> redisCache;
|
|
|
+ @Autowired
|
|
|
+ private SellOrderDao sellOrderDao;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Long, StudentRegistration> getDAO() {
|
|
|
@@ -871,16 +873,19 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
BigDecimal remitFee = studentPaymentOrder.getRemitFee() != null ? studentPaymentOrder.getRemitFee() : BigDecimal.ZERO;
|
|
|
BigDecimal balancePaymentAmount = studentPaymentOrder.getBalancePaymentAmount() != null ? studentPaymentOrder.getBalancePaymentAmount() : BigDecimal.ZERO;
|
|
|
//总价格
|
|
|
- BigDecimal totalPrice = orderDetails.stream().map(StudentPaymentOrderDetail::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add).subtract(remitFee);
|
|
|
+ BigDecimal totalPrice = studentPaymentOrder.getExpectAmount();
|
|
|
for (StudentPaymentOrderDetail orderDetail : orderDetails) {
|
|
|
if (orderDetail.getType().equals(OrderDetailTypeEnum.MUSICAL) && orderDetail.getKitGroupPurchaseType().equals(KitGroupPurchaseTypeEnum.LEASE)) {
|
|
|
continue;
|
|
|
}
|
|
|
+ if (orderDetail.getType().equals(OrderDetailTypeEnum.MUSICAL) && orderDetail.getKitGroupPurchaseType().equals(KitGroupPurchaseTypeEnum.GROUP)) {
|
|
|
+ orderDetail.setPrice(orderDetail.getPrice().subtract(remitFee));
|
|
|
+ }
|
|
|
|
|
|
BigDecimal goodsTotalPrice = orderDetail.getGoodsList().stream().map(Goods::getGroupPurchasePrice).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
for (Goods goods : orderDetail.getGoodsList()) {
|
|
|
- BigDecimal actualAmount = goods.getGroupPurchasePrice().multiply(orderDetail.getPrice().subtract(remitFee)).multiply(studentPaymentOrder.getActualAmount()).divide(goodsTotalPrice.multiply(totalPrice), 2, BigDecimal.ROUND_HALF_UP);
|
|
|
- BigDecimal balance = goods.getGroupPurchasePrice().multiply(orderDetail.getPrice().subtract(remitFee)).multiply(balancePaymentAmount).divide(goodsTotalPrice.multiply(totalPrice), 2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal actualAmount = goods.getGroupPurchasePrice().multiply(orderDetail.getPrice()).multiply(studentPaymentOrder.getActualAmount()).divide(goodsTotalPrice.multiply(totalPrice), 2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal balance = goods.getGroupPurchasePrice().multiply(orderDetail.getPrice()).multiply(balancePaymentAmount).divide(goodsTotalPrice.multiply(totalPrice), 2, BigDecimal.ROUND_HALF_UP);
|
|
|
SellOrder sellOrder = new SellOrder();
|
|
|
sellOrder.setOrganId(studentPaymentOrder.getOrganId());
|
|
|
sellOrder.setSchoolId(musicGroup.getSchoolId());
|
|
|
@@ -899,9 +904,17 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
sellOrder.setSellTime(studentPaymentOrder.getCreateTime());
|
|
|
sellOrder.setCreateIme(new Date());
|
|
|
sellOrder.setUpdateTime(new Date());
|
|
|
+ if (goods.getType().equals(GoodsType.INSTRUMENT)) {
|
|
|
+ sellOrder.setType(SellTypeEnum.INSTRUMENT);
|
|
|
+ } else if (goods.getType().equals(GoodsType.ACCESSORIES)) {
|
|
|
+ sellOrder.setType(SellTypeEnum.ACCESSORIES);
|
|
|
+ } else {
|
|
|
+ sellOrder.setType(SellTypeEnum.OTHER);
|
|
|
+ }
|
|
|
sellOrders.add(sellOrder);
|
|
|
}
|
|
|
}
|
|
|
+ sellOrderDao.batchInsert(sellOrders);
|
|
|
}
|
|
|
|
|
|
//三方乐团不发送缴费通知
|