|
@@ -274,6 +274,7 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
|
|
|
*/
|
|
|
|
|
|
Integer returnNum = 0;
|
|
|
+ Double returnNumAmount = 0d;
|
|
|
// 平台服务费
|
|
|
Double allServeAmount = 0d;
|
|
|
Double brokerage = 0d;
|
|
@@ -294,11 +295,28 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
|
|
|
// 付采美总金额
|
|
|
allServeAmount = MathUtil.add(allServeAmount, MathUtil.mul(p.getNum(), p.getCmCostPrice())).doubleValue();
|
|
|
// 子订单利润
|
|
|
- if (p.getProductType() == 0) {
|
|
|
- brokerage = MathUtil.add(brokerage, MathUtil.mul(p.getBrokerage(), p.getNum())).doubleValue();
|
|
|
+ if (p.getReturnedNum().equals(p.getNum())) {
|
|
|
+ if (p.getProductType() == 0) {
|
|
|
+ brokerage = MathUtil.add(brokerage, MathUtil.mul(p.getBrokerage(), p.getNum())).doubleValue();
|
|
|
+ } else {
|
|
|
+ brokerage = MathUtil.add(brokerage, 0).doubleValue();
|
|
|
+ }
|
|
|
+ } else if (p.getReturnedNum() < p.getNum()) {
|
|
|
+ if (p.getProductType() == 0) {
|
|
|
+ brokerage = MathUtil.add(brokerage, MathUtil.mul(p.getBrokerage(), MathUtil.sub(p.getNum(), p.getReturnedNum()))).doubleValue();
|
|
|
+ } else {
|
|
|
+ brokerage = MathUtil.add(brokerage, 0).doubleValue();
|
|
|
+ }
|
|
|
} else {
|
|
|
- brokerage = MathUtil.add(brokerage, 0).doubleValue();
|
|
|
+ if (p.getProductType() == 0) {
|
|
|
+ brokerage = MathUtil.add(brokerage, MathUtil.mul(p.getBrokerage(), p.getNum())).doubleValue();
|
|
|
+ } else {
|
|
|
+ brokerage = MathUtil.add(brokerage, 0).doubleValue();
|
|
|
+ }
|
|
|
}
|
|
|
+ allServeAmount = MathUtil.sub(allServeAmount, MathUtil.mul(returnNum, p.getCmCostPrice())).doubleValue();
|
|
|
+ // 应退的成本
|
|
|
+ returnNumAmount = MathUtil.mul(returnNum, p.getCostPrice()).doubleValue();
|
|
|
}
|
|
|
so.setBrokerage(brokerage);
|
|
|
so.setAllServeAmount(allServeAmount);
|
|
@@ -311,6 +329,9 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
|
|
|
BigDecimal waitPayShop = MathUtil.sub(so.getWaitPayShop(), so.getDifferencePrice());
|
|
|
so.setWaitPayShop(waitPayShop.doubleValue());
|
|
|
}
|
|
|
+ so.setWaitPayShop(MathUtil.sub(so.getWaitPayShop(), returnNumAmount).doubleValue());
|
|
|
+ so.setShopProductAmount(MathUtil.sub(so.getShopProductAmount(), returnNumAmount).doubleValue());
|
|
|
+ so.setShouldPayShopAmount(MathUtil.sub(so.getShouldPayShopAmount(), returnNumAmount).doubleValue());
|
|
|
|
|
|
//统计该子订单的主的收款金额和收款状态
|
|
|
NewOrder newOrder = newOrderDao.get(so.getOrderID().toString());
|