订单新增earningprice2

This commit is contained in:
苏尹岚
2020-03-19 16:34:30 +08:00
parent cb9c465e10
commit b6126857cc
7 changed files with 27 additions and 4 deletions

View File

@@ -425,6 +425,7 @@ func (c *OrderManager) updateOrderOtherInfo(order *model.GoodsOrder, db *dao.Dao
}
if err = c.updateOrderSkuOtherInfo(order, db, payPercentage, changePriceType); err == nil {
jxutils.RefreshOrderSkuRelated(order)
jxutils.RefreshOrderEarningPrice2(order, payPercentage)
// caculateOrderEarningPrice(order, payPercentage)
}
return err

View File

@@ -670,6 +670,7 @@ func (c *OrderManager) GetStoresOrderSaleInfoNew(ctx *jxcontext.Context, storeID
saleInfo.VendorPrice += v.VendorPrice * int64(v.Count)
saleInfo.SalePrice += v.SalePrice * int64(v.Count)
saleInfo.EarningPrice += v.EarningPrice * int64(v.Count)
saleInfo.EarningPrice2 = v.EarningPrice2
universalOrderID := jxutils.ComposeUniversalOrderID(v.VendorOrderID, v.VendorID)
if orderMap[universalOrderID] == nil {
@@ -746,6 +747,7 @@ func (c *OrderManager) GetStoresOrderSaleInfoNew(ctx *jxcontext.Context, storeID
saleInfo.SalePrice += v.SalePrice
saleInfo.EarningPrice += v.EarningPrice
saleInfo.Count++
saleInfo.EarningPrice2 = v.EarningPrice2
}
for _, v := range saleInfoMap {
saleInfoList = append(saleInfoList, v)

View File

@@ -37,6 +37,13 @@ func (c *BaseScheduler) CreateWaybillOnProviders(ctx *jxcontext.Context, order *
courierVendorID := storeCourier.VendorID
bill, err2 := c.CreateWaybill(courierVendorID, order, maxDeliveryFee)
if err = err2; err == nil {
stores, _ := dao.GetStoreList(dao.GetDB(), []int{order.StoreID}, nil, nil, nil, "")
if len(stores) > 0 {
if stores[0].PayPercentage <= 50 {
order.EarningPrice2 = (order.TotalShopMoney - bill.DesiredFee) * int64((100 - stores[0].PayPercentage/2)) / 10000
dao.UpdateEntity(dao.GetDB(), order, "EarningPrice2")
}
}
globals.SugarLogger.Debugf("CreateWaybillOnProviders orderID:%s userName:%s vendorID:%d bill:%v", order.VendorOrderID, userName, courierVendorID, bill)
bills = append(bills, bill)
if createOnlyOne {

View File

@@ -655,7 +655,7 @@ func (s *DefScheduler) isWaybillCourierSame(savedOrderInfo *WatchOrderInfo, bill
func (s *DefScheduler) addWaybill2Map(savedOrderInfo *WatchOrderInfo, bill *model.Waybill) {
if _, ok := savedOrderInfo.waybills[bill.WaybillVendorID]; ok {
if !model.IsWaybillPlatformOwn(bill) { // 购买平台重复发相同号的新运单是正常的,京东就是
if !model.IsWaybillPlatformOwn(bill) && savedOrderInfo.order.StoreID != 666666 { // 购买平台重复发相同号的新运单是正常的,京东就是
globals.SugarLogger.Warnf("addWaybill2Map bill:%v already exists", bill)
}
}