|
@@ -1,10 +1,7 @@
|
|
|
package com.ym.mec.biz.service.impl;
|
|
package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
-import com.ym.mec.biz.dal.dao.GoodsDao;
|
|
|
|
|
-import com.ym.mec.biz.dal.dao.MusicGroupDao;
|
|
|
|
|
-import com.ym.mec.biz.dal.dao.SellOrderDao;
|
|
|
|
|
-import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
|
|
|
|
|
|
|
+import com.ym.mec.biz.dal.dao.*;
|
|
|
import com.ym.mec.biz.dal.entity.*;
|
|
import com.ym.mec.biz.dal.entity.*;
|
|
|
import com.ym.mec.biz.dal.enums.*;
|
|
import com.ym.mec.biz.dal.enums.*;
|
|
|
import com.ym.mec.biz.service.*;
|
|
import com.ym.mec.biz.service.*;
|
|
@@ -35,6 +32,8 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
|
|
|
private SysUserCashAccountService sysUserCashAccountService;
|
|
private SysUserCashAccountService sysUserCashAccountService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private GoodsService goodsService;
|
|
private GoodsService goodsService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private StudentPaymentOrderDetailDao studentPaymentOrderDetailDao;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public BaseDAO<Integer, SellOrder> getDAO() {
|
|
public BaseDAO<Integer, SellOrder> getDAO() {
|
|
@@ -335,4 +334,19 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
|
|
|
return sellOrderDao.getRefundSellOrder(orderId);
|
|
return sellOrderDao.getRefundSellOrder(orderId);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public BigDecimal getSellActualAmount(Long orderId) {
|
|
|
|
|
+ StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.get(orderId);
|
|
|
|
|
+ List<StudentPaymentOrderDetail> orderDetails = studentPaymentOrderDetailDao.getOrderDetail(orderId);
|
|
|
|
|
+ //总余额支付
|
|
|
|
|
+ BigDecimal totalBalance = studentPaymentOrder.getBalancePaymentAmount() != null ? studentPaymentOrder.getBalancePaymentAmount() : BigDecimal.ZERO;
|
|
|
|
|
+ //总价格
|
|
|
|
|
+ BigDecimal totalPrice = studentPaymentOrder.getExpectAmount();
|
|
|
|
|
+ //商品总付款
|
|
|
|
|
+ BigDecimal detailTotalPrice = orderDetails.stream().map(StudentPaymentOrderDetail::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
|
+ //商品销售占的余额
|
|
|
|
|
+ BigDecimal detailTotalBalance = detailTotalPrice.multiply(totalBalance).divide(totalPrice, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
+ return detailTotalPrice.subtract(detailTotalBalance);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|