This commit is contained in:
邹宗楠
2024-05-16 13:58:01 +08:00
parent 6053aca730
commit befb0e6906
2 changed files with 9 additions and 1 deletions

View File

@@ -670,7 +670,6 @@ func CreateAct(ctx *jxcontext.Context, act *model.Act, vendorIDs []int, vendorOr
} }
func CreateActForMtByOrder(ctx *jxcontext.Context, act *model.Act, vendorIDs []int, vendorOrgCode string, actStoreSku []*ActStoreSkuParam) (err error) { func CreateActForMtByOrder(ctx *jxcontext.Context, act *model.Act, vendorIDs []int, vendorOrgCode string, actStoreSku []*ActStoreSkuParam) (err error) {
globals.SugarLogger.Debugf("================actStoreSku := %s", utils.Format4Output(actStoreSku, false))
var ( var (
db = dao.GetDB() db = dao.GetDB()
actStoreSkuMap = make(map[int][]*model.StoreSkuBind) actStoreSkuMap = make(map[int][]*model.StoreSkuBind)
@@ -722,6 +721,7 @@ func CreateActForMtByOrder(ctx *jxcontext.Context, act *model.Act, vendorIDs []i
// } // }
// } // }
//} //}
globals.SugarLogger.Debugf("================createACte := %s", utils.Format4Output(1111, false))
txDB, _ := dao.Begin(db) txDB, _ := dao.Begin(db)
defer func() { defer func() {
if r := recover(); r != nil { if r := recover(); r != nil {
@@ -730,6 +730,7 @@ func CreateActForMtByOrder(ctx *jxcontext.Context, act *model.Act, vendorIDs []i
} }
}() }()
dao.WrapAddIDCULDEntity(act, ctx.GetUserName()) dao.WrapAddIDCULDEntity(act, ctx.GetUserName())
globals.SugarLogger.Debugf("================createACte := %s", utils.Format4Output(2222, false))
err = dao.CreateEntityTx(txDB, act) err = dao.CreateEntityTx(txDB, act)
if err != nil { if err != nil {
dao.Rollback(db, txDB) dao.Rollback(db, txDB)
@@ -740,12 +741,14 @@ func CreateActForMtByOrder(ctx *jxcontext.Context, act *model.Act, vendorIDs []i
VendorID: vendorID, VendorID: vendorID,
VendorOrgCode: vendorOrgCode, VendorOrgCode: vendorOrgCode,
} }
globals.SugarLogger.Debugf("================createACte := %s", utils.Format4Output(3333, false))
dao.WrapAddIDCULDEntity(actMap, ctx.GetUserName()) dao.WrapAddIDCULDEntity(actMap, ctx.GetUserName())
err = dao.CreateEntityTx(txDB, actMap) err = dao.CreateEntityTx(txDB, actMap)
if err != nil { if err != nil {
dao.Rollback(db, txDB) dao.Rollback(db, txDB)
return err return err
} }
globals.SugarLogger.Debugf("================createACte := %s", utils.Format4Output(444, false))
for storeID, storeSkus := range actStoreSkuMap { for storeID, storeSkus := range actStoreSkuMap {
for _, storeSku := range storeSkus { for _, storeSku := range storeSkus {
actStoreSkuModel := &model.ActStoreSku{ actStoreSkuModel := &model.ActStoreSku{
@@ -757,6 +760,7 @@ func CreateActForMtByOrder(ctx *jxcontext.Context, act *model.Act, vendorIDs []i
ActPrice: int64(storeSku.JdsPrice), ActPrice: int64(storeSku.JdsPrice),
} }
dao.WrapAddIDCULDEntity(actStoreSkuModel, ctx.GetUserName()) dao.WrapAddIDCULDEntity(actStoreSkuModel, ctx.GetUserName())
globals.SugarLogger.Debugf("================createACte := %s", utils.Format4Output(555, false))
err = dao.CreateEntityTx(txDB, actStoreSkuModel) err = dao.CreateEntityTx(txDB, actStoreSkuModel)
if err != nil { if err != nil {
dao.Rollback(db, txDB) dao.Rollback(db, txDB)
@@ -772,6 +776,7 @@ func CreateActForMtByOrder(ctx *jxcontext.Context, act *model.Act, vendorIDs []i
ActualActPrice: int64(storeSku.JdsPrice), ActualActPrice: int64(storeSku.JdsPrice),
} }
dao.WrapAddIDCULDEntity(actStoreSkuMapModel, ctx.GetUserName()) dao.WrapAddIDCULDEntity(actStoreSkuMapModel, ctx.GetUserName())
globals.SugarLogger.Debugf("================createACte := %s", utils.Format4Output(666, false))
err = dao.CreateEntityTx(txDB, actStoreSkuMapModel) err = dao.CreateEntityTx(txDB, actStoreSkuMapModel)
if err != nil { if err != nil {
dao.Rollback(db, txDB) dao.Rollback(db, txDB)
@@ -779,6 +784,7 @@ func CreateActForMtByOrder(ctx *jxcontext.Context, act *model.Act, vendorIDs []i
} }
} }
} }
globals.SugarLogger.Debugf("================createACte := %s", utils.Format4Output(1111, false))
dao.Commit(db, txDB) dao.Commit(db, txDB)
if !globals.IsProductEnv() { if !globals.IsProductEnv() {
return err return err

View File

@@ -2,6 +2,7 @@ package controllers
import ( import (
"fmt" "fmt"
"git.rosy.net.cn/jx-callback/globals"
"git.rosy.net.cn/jx-callback/business/partner/purchase/mtwm" "git.rosy.net.cn/jx-callback/business/partner/purchase/mtwm"
@@ -160,6 +161,7 @@ func (c *ActController) CreateActForMtByOrder() {
} }
//retVal, err = act.CreateAct(params.Ctx, actObj, vendorIDs, params.VendorOrgCode, nil, actStoreSkuList, params.IsAsync) //retVal, err = act.CreateAct(params.Ctx, actObj, vendorIDs, params.VendorOrgCode, nil, actStoreSkuList, params.IsAsync)
err = act.CreateActForMtByOrder(params.Ctx, actObj, vendorIDs, params.VendorOrgCode, actStoreSkuList) err = act.CreateActForMtByOrder(params.Ctx, actObj, vendorIDs, params.VendorOrgCode, actStoreSkuList)
globals.SugarLogger.Debugf("================CreateActForMtByOrder := %v", err)
} }
} }
return "success", "", err return "success", "", err