This commit is contained in:
邹宗楠
2023-08-29 18:12:54 +08:00
parent 63dcfccf66
commit 88f56043e6

View File

@@ -1794,12 +1794,6 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
syncStatus |= model.SyncFlagStoreName syncStatus |= model.SyncFlagStoreName
} }
// 增加门店地址修改同步
storeDetail, err := dao.GetStoreBaseByVendorStoreID(storeMap.VendorStoreID, storeMap.VendorID)
if err != nil || storeDetail == nil {
return 0, fmt.Errorf("基础门店信息异常,请联系管理员")
}
//增加同步到抖店厂商的同步标志 //增加同步到抖店厂商的同步标志
DDFlag := false DDFlag := false
errList := errlist.ErrList{} errList := errlist.ErrList{}
@@ -1843,6 +1837,20 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
} }
} }
// 增加门店地址修改同步
storeDetail, err := dao.GetStoreBaseByVendorStoreID(storeMap.VendorStoreID, storeMap.VendorID)
if err != nil || storeDetail == nil {
return 0, fmt.Errorf("基础门店信息异常,请联系管理员")
}
if storeDetail != nil && payload["address"].(string) != storeDetail.Address {
// 修改门店地址
storeDetail.Address = payload["address"].(string)
dao.UpdateEntity(db, storeDetail, "Address")
// 添加同步
valid["address"] = payload["address"].(string)
syncStatus |= model.SyncFlagStoreName
}
if err == nil { if err == nil {
if len(valid) > 0 { if len(valid) > 0 {
txDB, _ := dao.Begin(db) txDB, _ := dao.Begin(db)
@@ -1853,19 +1861,23 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
} }
}() }()
if isStoreMapNeedSync(vendorID, valid) { // 对于store vendor map只有Status改变才需要同步到厂商 // storeMap 不包含address参数
num, err = dao.UpdateEntityLogicallyAndUpdateSyncStatus(db, storeMap, valid, userName, map[string]interface{}{ if valid["address"] == nil {
model.FieldStoreID: storeID, if isStoreMapNeedSync(vendorID, valid) { // 对于store vendor map只有Status改变才需要同步到厂商
model.FieldVendorID: vendorID, num, err = dao.UpdateEntityLogicallyAndUpdateSyncStatus(db, storeMap, valid, userName, map[string]interface{}{
//"VendorOrgCode": vendorOrgCode, model.FieldStoreID: storeID,
}, model.FieldSyncStatus, syncStatus) model.FieldVendorID: vendorID,
} else { //"VendorOrgCode": vendorOrgCode,
num, err = dao.UpdateEntityLogically(db, storeMap, valid, userName, map[string]interface{}{ }, model.FieldSyncStatus, syncStatus)
model.FieldStoreID: storeID, } else {
model.FieldVendorID: vendorID, num, err = dao.UpdateEntityLogically(db, storeMap, valid, userName, map[string]interface{}{
//"VendorOrgCode": vendorOrgCode, model.FieldStoreID: storeID,
}) model.FieldVendorID: vendorID,
//"VendorOrgCode": vendorOrgCode,
})
}
} }
if err != nil { if err != nil {
dao.Rollback(db, txDB) dao.Rollback(db, txDB)
return 0, err return 0, err
@@ -1895,14 +1907,6 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
} }
dao.Commit(db, txDB) dao.Commit(db, txDB)
if storeDetail != nil && payload["address"].(string) != storeDetail.Address {
// 修改门店地址
storeDetail.Address = payload["address"].(string)
dao.UpdateEntity(db, storeDetail, "Address")
// 添加同步
valid["address"] = payload["address"].(string)
syncStatus |= model.SyncFlagStoreName
}
if isStoreMapNeedSync(vendorID, valid) { if isStoreMapNeedSync(vendorID, valid) {
_, err = CurVendorSync.SyncStore(ctx, db, vendorID, storeID, false, userName) _, err = CurVendorSync.SyncStore(ctx, db, vendorID, storeID, false, userName)
} }