This commit is contained in:
邹宗楠
2022-04-07 18:47:06 +08:00
parent 91dc8e6210
commit c0cd8aa426
3 changed files with 13 additions and 11 deletions

View File

@@ -4,7 +4,6 @@ import (
"fmt"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxcallback/scheduler"
"git.rosy.net.cn/jx-callback/business/jxcallback/scheduler/defsch"
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
"git.rosy.net.cn/jx-callback/business/jxutils"
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
@@ -185,7 +184,7 @@ func (c *BaseScheduler) CreateWaybill(platformVendorID int, order *model.GoodsOr
return nil, err
}
var balance int
if storeList[0].BrandID == defsch.JXC4B_SHOP || storeList[0].BrandID == defsch.JXC4B_RAND_JXGY { // 京西品牌,扣门店
if storeList[0].BrandID == scheduler.JXC4B_SHOP || storeList[0].BrandID == scheduler.JXC4B_RAND_JXGY { // 京西品牌,扣门店
balance = storeAcct.AccountBalance
} else {
if storeAcct.AccountBalance >= model.BrandBalanceLimit {

View File

@@ -18,10 +18,6 @@ import (
"git.rosy.net.cn/jx-callback/globals"
)
const (
JXC4B_RAND_JXGY = 1 // 京西菜市和果园品牌id
JXC4B_SHOP = 7 // 京西超市
)
func (s *DefScheduler) loadSavedOrderByID(vendorOrderID string, vendorID int, isForceLoad bool) *WatchOrderInfo {
return s.loadSavedOrderFromMap(&model.OrderStatus{
@@ -177,7 +173,7 @@ func (s *DefScheduler) CreateWaybillOnProviders4SavedOrder(ctx *jxcontext.Contex
newPrice = maxFee
}
// 门店支出运费
if storeList[0].BrandID != JXC4B_SHOP && storeList[0].BrandID != JXC4B_RAND_JXGY { // 非京西品牌,先扣门店在扣品牌
if storeList[0].BrandID != scheduler.JXC4B_SHOP && storeList[0].BrandID != scheduler.JXC4B_RAND_JXGY { // 非京西品牌,先扣门店在扣品牌
if storeAcct.AccountBalance > int(newPrice) {
if int(newPrice) > lastFee {
// 门店支出费用
@@ -204,7 +200,7 @@ func (s *DefScheduler) CreateWaybillOnProviders4SavedOrder(ctx *jxcontext.Contex
if len(courierVendorIDs) == 1 {
courierVendorID := courierVendorIDs[0]
if _, ok := deliveryFeeMap[courierVendorID]; ok {
if storeList[0].BrandID != JXC4B_SHOP && storeList[0].BrandID != JXC4B_RAND_JXGY { // 非京西品牌,先扣门店在扣品牌
if storeList[0].BrandID != scheduler.JXC4B_SHOP && storeList[0].BrandID != scheduler.JXC4B_RAND_JXGY { // 非京西品牌,先扣门店在扣品牌
if storeAcct.AccountBalance > int(model.Waybill{}.DesiredFee) {
partner.CurStoreAcctManager.InsertStoreAcctExpendAndUpdateStoreAcctBalance(ctx, jxutils.GetSaleStoreIDFromOrder(order), int(model.Waybill{}.DesiredFee), partner.StoreAcctTypeExpendCreateWaybill2ndMore, order.VendorOrderID, expend.ID) //int(newPrice)-lastFee
} else if result > int(model.Waybill{}.DesiredFee) {
@@ -346,7 +342,7 @@ func (s *DefScheduler) CheckStoreBalance(ctx *jxcontext.Context, order *model.Go
_, lastFee, _ := partner.CurStoreAcctManager.GetStoreAcctExpendLastCreateWayBillFee(order.VendorOrderID)
// 如果门店属于京西菜市,京西果园则只能扣门店的金额
if int(newPrice) > lastFee {
if storeList[0].BrandID == JXC4B_RAND_JXGY || storeList[0].BrandID == JXC4B_SHOP { // 订单所属门店属于京西菜市,果园,则不扣品牌只扣门店)(1果园,菜市,7京西超市)
if storeList[0].BrandID == scheduler.JXC4B_RAND_JXGY || storeList[0].BrandID == scheduler.JXC4B_SHOP { // 订单所属门店属于京西菜市,果园,则不扣品牌只扣门店)(1果园,菜市,7京西超市)
if storeAcct.AccountBalance < int(newPrice)-lastFee {
return model.ErrCodeAccountBalanceNotEnough, fmt.Errorf("门店/品牌账户余额小于[%v]元,不能发配送!", jxutils.IntPrice2Standard(newPrice-int64(lastFee)))
}
@@ -360,7 +356,7 @@ func (s *DefScheduler) CheckStoreBalance(ctx *jxcontext.Context, order *model.Go
if len(courierVendorIDs) == 1 {
courierVendorID := courierVendorIDs[0]
if _, ok := deliveryFeeMap[courierVendorID]; ok {
if storeList[0].BrandID == JXC4B_RAND_JXGY || storeList[0].BrandID == JXC4B_SHOP { // 订单所属门店属于京西菜市,果园,则不扣品牌只扣门店)(1果园,菜市,7京西超市)
if storeList[0].BrandID == scheduler.JXC4B_RAND_JXGY || storeList[0].BrandID == scheduler.JXC4B_SHOP { // 订单所属门店属于京西菜市,果园,则不扣品牌只扣门店)(1果园,菜市,7京西超市)
if deliveryFeeMap[courierVendorID].DeliveryFee > int64(storeAcct.AccountBalance) {
return model.ErrCodeAccountBalanceNotEnough, fmt.Errorf("门店/品牌账户余额小于[%v]元,不能发配送!", jxutils.IntPrice2Standard(partner.MinCreateWaybillBalance))
}
@@ -377,7 +373,7 @@ func (s *DefScheduler) CheckStoreBalance(ctx *jxcontext.Context, order *model.Go
v.DeliveryFee = maxFee
}
}
if storeList[0].BrandID == JXC4B_RAND_JXGY || storeList[0].BrandID == JXC4B_SHOP { // 订单所属门店属于京西菜市,果园,则不扣品牌只扣门店)(1果园,菜市,7京西超市)
if storeList[0].BrandID == scheduler.JXC4B_RAND_JXGY || storeList[0].BrandID == scheduler.JXC4B_SHOP { // 订单所属门店属于京西菜市,果园,则不扣品牌只扣门店)(1果园,菜市,7京西超市)
if maxFee > int64(storeAcct.AccountBalance) {
return model.ErrCodeAccountBalanceNotEnough, fmt.Errorf("门店/品牌账户余额小于[%v]元,不能发配送!", jxutils.IntPrice2Standard(partner.MinCreateWaybillBalance))
}

View File

@@ -16,8 +16,15 @@ const (
TimerStatusTypeUnknown = -1
TimerStatusTypeOrder = 0
TimerStatusTypeWaybill = 1
)
const (
JXC4B_RAND_JXGY = 1 // 京西菜市和果园品牌id
JXC4B_SHOP = 7 // 京西超市
)
var (
CurrentScheduler IScheduler
)