修改门店发单和品牌发单是扣费问题

This commit is contained in:
邹宗楠
2023-05-11 10:58:50 +08:00
parent 85b2870a5e
commit 476f8c0943
26 changed files with 417 additions and 273 deletions

View File

@@ -4586,14 +4586,6 @@ func GetStoreAcctBalance(ctx *jxcontext.Context, storeID int) (storeAcct *model.
}, err
}
// func SendVendorStoreStatusChanged(ctx *jxcontext.Context) (err error) {
// var (
// db = dao.GetDB()
// )
// dao.GetStoresMapList(db, []int{model.VendorIDJD, model.VendorIDMTWM, model.VendorIDEBAI}, nil, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "", "")
// return err
// }
func RefreshStoreBind(ctx *jxcontext.Context) (err error) {
var (
db = dao.GetDB()

View File

@@ -23,7 +23,7 @@ func init() {
partner.InitStoreAcctManager(FixedStoreAcctManager)
}
func InsertStoreAcctIncome(ctx *jxcontext.Context, storeID, price, acctType int, vendorOrderID string, expendID int) (err error) {
func InsertStoreAcctIncome(ctx *jxcontext.Context, storeID, price, acctType int, vendorOrderID, vendorWaybillId string, expendID int) (err error) {
var (
userID, userName string
goodsVendorOrderID string
@@ -44,11 +44,12 @@ func InsertStoreAcctIncome(ctx *jxcontext.Context, storeID, price, acctType int,
}
}
storeAcctIncome := &model.StoreAcctIncome{
StoreID: storeID,
IncomePrice: price,
Type: acctType,
UserID: userID,
VendorOrderID: goodsVendorOrderID,
StoreID: storeID,
IncomePrice: price,
Type: acctType,
UserID: userID,
VendorOrderID: goodsVendorOrderID,
VendorWaybillID: vendorWaybillId,
}
dao.WrapAddIDCULEntity(storeAcctIncome, userName)
if expendID != 0 {
@@ -58,7 +59,7 @@ func InsertStoreAcctIncome(ctx *jxcontext.Context, storeID, price, acctType int,
return err
}
func InsertStoreAcctExpend(ctx *jxcontext.Context, storeID, price, acctType int, vendorOrderID string, expendID int) (err error) {
func InsertStoreAcctExpend(ctx *jxcontext.Context, storeID, price, acctType int, vendorOrderID, vendorWaybillId string, expendID int) (err error) {
var (
userID, userName string
db = dao.GetDB()
@@ -76,11 +77,12 @@ func InsertStoreAcctExpend(ctx *jxcontext.Context, storeID, price, acctType int,
}
}
storeAcctExpend := &model.StoreAcctExpend{
StoreID: storeID,
ExpendPrice: price,
Type: acctType,
UserID: userID,
VendorOrderID: vendorOrderID,
StoreID: storeID,
ExpendPrice: price,
Type: acctType,
UserID: userID,
VendorOrderID: vendorOrderID,
VendorWaybillID: vendorWaybillId,
}
dao.WrapAddIDCULEntity(storeAcctExpend, userName)
if expendID != 0 {
@@ -132,18 +134,18 @@ func (s *StoreAcctManager) UpdateStoreAcctBalance(ctx *jxcontext.Context, storeI
}
// 门店到账(老版本,修改门店的交易记录)
func (s *StoreAcctManager) InsertStoreAcctExpendAndUpdateStoreAcctBalance(ctx *jxcontext.Context, storeID, price, acctType int, vendorOrderID string, expendID int) (err error) {
func (s *StoreAcctManager) InsertStoreAcctExpendAndUpdateStoreAcctBalance(ctx *jxcontext.Context, storeID, price, acctType int, vendorOrderID, vendorWaybillID string, expendID int) (err error) {
utils.CallFuncAsync(func() {
if err = InsertStoreAcctExpend(ctx, storeID, price, acctType, vendorOrderID, expendID); err == nil {
if err = InsertStoreAcctExpend(ctx, storeID, price, acctType, vendorOrderID, vendorWaybillID, expendID); err == nil {
s.UpdateStoreAcctBalance(ctx, storeID, price, false)
}
})
return err
}
func (s *StoreAcctManager) InsertStoreAcctIncomeAndUpdateStoreAcctBalance(ctx *jxcontext.Context, storeID, price, acctType int, vendorOrderID string, expendID int) (err error) {
func (s *StoreAcctManager) InsertStoreAcctIncomeAndUpdateStoreAcctBalance(ctx *jxcontext.Context, storeID, price, acctType int, vendorOrderID, vendorWaybillID string, expendID int) (err error) {
utils.CallFuncAsync(func() {
if err = InsertStoreAcctIncome(ctx, storeID, price, acctType, vendorOrderID, expendID); err == nil {
if err = InsertStoreAcctIncome(ctx, storeID, price, acctType, vendorOrderID, vendorWaybillID, expendID); err == nil {
s.UpdateStoreAcctBalance(ctx, storeID, price, true)
}
})
@@ -156,9 +158,9 @@ func (s *StoreAcctManager) CheckStoreAcctExpendExist(vendorOrderID string) (isEq
expends, incomes int
db = dao.GetDB()
)
// 发单扣除的临时运费
expends, err = dao.GetStoreAcctExpendTotal(db, 0, []int{partner.StoreAcctTypeExpendCreateWaybillEx, partner.StoreAcctTypeRealFeeExpend}, vendorOrderID, utils.ZeroTimeValue, utils.ZeroTimeValue)
// 真实运费 < 临时运费, 临时运费-真实运费的值
// 当前订单的支出金额(临时运费+真实运费)[小费]
expends, err = dao.GetStoreAcctExpendTotal(db, 0, []int{partner.StoreAcctTypeExpendCreateWaybillEx, partner.StoreAcctTypeExpendCreateWaybillTip, partner.StoreAcctTypeExpendCreateWaybill2ndMore, partner.StoreAcctTypeExpendCreateWaybillDeductFee, partner.StoreAcctTypeRealFeeExpend}, vendorOrderID, utils.ZeroTimeValue, utils.ZeroTimeValue)
// 当前订单的退费金额()
incomes, err = dao.GetStoreAcctIncomeTotal(db, 0, []int{partner.StoreAcctTypeRealFeeIncome, partner.StoreAcctTypeIncomeCancelTemp, partner.StoreAcctTypeIncomeCancelReal}, vendorOrderID, utils.ZeroTimeValue, utils.ZeroTimeValue)
if expends != incomes {
if expends > incomes {

View File

@@ -199,6 +199,7 @@ func Init() {
orderman.UpdateTiktokShopTotalMoney()
}, []string{
"03:35:00",
"09:35:00",
})
// 每分钟轮询一次,推送抖店骑手信息
@@ -593,8 +594,8 @@ func syncStoreSku() {
tasksch.HandleTask(task, nil, true).Run()
}
var storeIds = []int{
668802, 668787, 668785, 668777, 668769, 668776, 668770, 668760, 668758, 668756, 668748, 668727, 668723, 300372, 668715, 668717, 668707, 668667, 668668, 800306, 668628, 668681, 668673, 668544, 668619, 668614, 668600, 102217, 667405, 100988, 668353, 103022, 668283, 667208, 668266, 102101, 100610, 103201, 103459, 667154, 102691, 666747, 103417, 666744, 666864, 102186, 667271, 101750, 101031, 667452, 666942, 666927, 100068, 668339, 668306, 668310, 667352, 102544, 667014, 102280, 667134, 102945, 103062, 102443, 668218, 666913, 102742, 668360, 102851, 668580, 667252, 666746, 100455, 667037, 667317, 667473, 666816, 103063, 666800, 668210, 103079, 668200, 668176, 667462, 102426, 667116, 668309, 100193, 666828, 666944, 102852, 666900, 668521, 668373, 102596, 668444, 667071, 668264, 668395, 668090, 102172, 102790, 101935, 667480, 102479, 103197, 102703, 668386, 668229, 666948, 101008, 668249, 102374, 667464, 668468, 102490, 666756, 102976, 667467, 666707, 668270, 667429, 103098, 668135, 668523, 666907, 668407, 668358, 668385, 101134, 100887, 668568, 668003, 101763, 100829, 667476, 101078, 668099, 668503, 666807, 100167, 100433, 668107, 667262, 100849, 102771, 667173, 666847, 667485, 102821, 666955, 101107, 667229, 102950, 103435, 102497, 666916, 668163, 668061, 102147, 668248, 667066, 102853, 667944, 100002, 102865, 668219, 100184, 666840, 667057, 668202, 102223, 667101, 667128, 101110, 668511, 103151, 667093, 668154, 666905, 668268, 666929, 102935, 102074, 668174, 668217, 102350, 666940, 102980, 668117, 668384, 100067, 101916, 102987, 667250, 668570, 667466, 101099, 667082, 100229, 667553, 100215, 667991, 100217, 103073, 103074, 103037, 668180, 668583, 668462, 667891, 666811, 666736, 668173, 100267, 102962, 102752, 668284, 667296, 668175, 667806, 103103, 103084, 668453, 102970, 103184, 668548, 101036, 668182, 668157, 668257, 668166, 668543, 668170, 668071, 667744, 102925, 100115, 668093, 667745, 668164, 668156, 667743, 668165, 103408, 103038, 667268, 667094, 667321, 100726, 102333, 666742, 101775, 100028, 668304, 667305, 101942, 668575, 101755, 103425, 102833, 100699, 103190, 666711, 668396, 100334, 102533, 100336, 101995, 102320, 101842, 102519, 101999, 102433, 100920, 102594, 102951, 668506, 666667, 102963, 300034, 667212, 100236, 101909, 668541, 102857, 668417, 102955, 103031, 668545, 666790, 100328}
//var storeIds = []int{
// 668802, 668787, 668785, 668777, 668769, 668776, 668770, 668760, 668758, 668756, 668748, 668727, 668723, 300372, 668715, 668717, 668707, 668667, 668668, 800306, 668628, 668681, 668673, 668544, 668619, 668614, 668600, 102217, 667405, 100988, 668353, 103022, 668283, 667208, 668266, 102101, 100610, 103201, 103459, 667154, 102691, 666747, 103417, 666744, 666864, 102186, 667271, 101750, 101031, 667452, 666942, 666927, 100068, 668339, 668306, 668310, 667352, 102544, 667014, 102280, 667134, 102945, 103062, 102443, 668218, 666913, 102742, 668360, 102851, 668580, 667252, 666746, 100455, 667037, 667317, 667473, 666816, 103063, 666800, 668210, 103079, 668200, 668176, 667462, 102426, 667116, 668309, 100193, 666828, 666944, 102852, 666900, 668521, 668373, 102596, 668444, 667071, 668264, 668395, 668090, 102172, 102790, 101935, 667480, 102479, 103197, 102703, 668386, 668229, 666948, 101008, 668249, 102374, 667464, 668468, 102490, 666756, 102976, 667467, 666707, 668270, 667429, 103098, 668135, 668523, 666907, 668407, 668358, 668385, 101134, 100887, 668568, 668003, 101763, 100829, 667476, 101078, 668099, 668503, 666807, 100167, 100433, 668107, 667262, 100849, 102771, 667173, 666847, 667485, 102821, 666955, 101107, 667229, 102950, 103435, 102497, 666916, 668163, 668061, 102147, 668248, 667066, 102853, 667944, 100002, 102865, 668219, 100184, 666840, 667057, 668202, 102223, 667101, 667128, 101110, 668511, 103151, 667093, 668154, 666905, 668268, 666929, 102935, 102074, 668174, 668217, 102350, 666940, 102980, 668117, 668384, 100067, 101916, 102987, 667250, 668570, 667466, 101099, 667082, 100229, 667553, 100215, 667991, 100217, 103073, 103074, 103037, 668180, 668583, 668462, 667891, 666811, 666736, 668173, 100267, 102962, 102752, 668284, 667296, 668175, 667806, 103103, 103084, 668453, 102970, 103184, 668548, 101036, 668182, 668157, 668257, 668166, 668543, 668170, 668071, 667744, 102925, 100115, 668093, 667745, 668164, 668156, 667743, 668165, 103408, 103038, 667268, 667094, 667321, 100726, 102333, 666742, 101775, 100028, 668304, 667305, 101942, 668575, 101755, 103425, 102833, 100699, 103190, 666711, 668396, 100334, 102533, 100336, 101995, 102320, 101842, 102519, 101999, 102433, 100920, 102594, 102951, 668506, 666667, 102963, 300034, 667212, 100236, 101909, 668541, 102857, 668417, 102955, 103031, 668545, 666790, 100328}
func syncStoreSkuTiktok() {
//syncFlag := 0 | model.SyncFlagSaleMask
@@ -609,7 +610,7 @@ func syncStoreSkuTiktok() {
if beego.BConfig.RunMode != "jxgy" {
errList.AddErr(cms.DeleteSkuNameExPrefixOverdue(db))
errList.AddErr(cms.SetMultiStoreSkuSyncModifyStatus(db, partner.GetMultiStoreVendorIDs()))
_, err = cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, []int{model.VendorIDDD}, storeIds, false, nil, nil, syncFlag, true, true)
_, err = cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, []int{model.VendorIDDD}, nil, false, nil, nil, syncFlag, true, true)
errList.AddErr(err)
}
case 1: