测试
This commit is contained in:
@@ -2,8 +2,6 @@ package cms
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.rosy.net.cn/baseapi/platformapi/mtpsapi"
|
|
||||||
"git.rosy.net.cn/jx-callback/globals/api"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
@@ -561,92 +559,92 @@ func CompareJxAndMultiVenderDepot(ctx *jxcontext.Context, vendorMap map[int]bool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func StoreOpenAll(ctx *jxcontext.Context) {
|
//func StoreOpenAll(ctx *jxcontext.Context) {
|
||||||
globals.SugarLogger.Debug("StoreOpenAll skuID is start")
|
// globals.SugarLogger.Debug("StoreOpenAll skuID is start")
|
||||||
/*获取美团门店信息*/
|
// /*获取美团门店信息*/
|
||||||
StoreInfoList, _ := api.MtpsAPI.GetStoreStatusAll()
|
// StoreInfoList, _ := api.MtpsAPI.GetStoreStatusAll()
|
||||||
StoreInfoList2 := make(map[string]string)
|
// StoreInfoList2 := make(map[string]string)
|
||||||
for _, store := range StoreInfoList {
|
// for _, store := range StoreInfoList {
|
||||||
for _, data := range store.DataList {
|
// for _, data := range store.DataList {
|
||||||
StoreInfoList2[data.OuterPoiID] = data.PoiName
|
// StoreInfoList2[data.OuterPoiID] = data.PoiName
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
db := dao.GetDB()
|
// db := dao.GetDB()
|
||||||
/*比较营业状态*/
|
// /*比较营业状态*/
|
||||||
/*把获取的京西状态和名称存一下*/
|
// /*把获取的京西状态和名称存一下*/
|
||||||
StoreCourierList, _ := dao.GetStoreCourierList(db, []int{}, model.StoreStatusAll, model.StoreStatusAll)
|
// StoreCourierList, _ := dao.GetStoreCourierList(db, []int{}, model.StoreStatusAll, model.StoreStatusAll)
|
||||||
/*循环美团*/
|
// /*循环美团*/
|
||||||
for _, StoreInfoList1 := range StoreInfoList {
|
// for _, StoreInfoList1 := range StoreInfoList {
|
||||||
for _, StoreInfoList11 := range StoreInfoList1.DataList {
|
// for _, StoreInfoList11 := range StoreInfoList1.DataList {
|
||||||
/*循环京西*/
|
// /*循环京西*/
|
||||||
for _, StoreCourierList1 := range StoreCourierList {
|
// for _, StoreCourierList1 := range StoreCourierList {
|
||||||
/*只比较美团*/
|
// /*只比较美团*/
|
||||||
if StoreCourierList1.VendorID != model.VendorIDMTPS {
|
// if StoreCourierList1.VendorID != model.VendorIDMTPS {
|
||||||
continue
|
// continue
|
||||||
}
|
// }
|
||||||
/*如果门店ID相同的时候进入判断,一个门店只用判断一次就行*/
|
// /*如果门店ID相同的时候进入判断,一个门店只用判断一次就行*/
|
||||||
if StoreCourierList1.VendorStoreID == StoreInfoList11.OuterPoiID {
|
// if StoreCourierList1.VendorStoreID == StoreInfoList11.OuterPoiID {
|
||||||
if StoreCourierList1.Status != StoreInfoList11.OpenType {
|
// if StoreCourierList1.Status != StoreInfoList11.OpenType {
|
||||||
sl := make(map[string]interface{})
|
// sl := make(map[string]interface{})
|
||||||
sl["vendorStoreID"] = StoreInfoList11.OuterPoiID
|
// sl["vendorStoreID"] = StoreInfoList11.OuterPoiID
|
||||||
sl["status"] = StoreInfoList11.OpenType
|
// sl["status"] = StoreInfoList11.OpenType
|
||||||
globals.SugarLogger.Debugf("被修改配送状态的VendorStoreID是:%s,名称是:%s,美团状态是:%s,本地状态是:%s",
|
// globals.SugarLogger.Debugf("被修改配送状态的VendorStoreID是:%s,名称是:%s,美团状态是:%s,本地状态是:%s",
|
||||||
StoreInfoList11.OuterPoiID, StoreInfoList11.PoiName, strconv.Itoa(StoreInfoList11.OpenType), strconv.Itoa(StoreCourierList1.Status))
|
// StoreInfoList11.OuterPoiID, StoreInfoList11.PoiName, strconv.Itoa(StoreInfoList11.OpenType), strconv.Itoa(StoreCourierList1.Status))
|
||||||
UpdateStoreCourierMap(ctx, nil, StoreCourierList1.StoreID, StoreCourierList1.VendorID, sl, ctx.GetUserName())
|
// UpdateStoreCourierMap(ctx, nil, StoreCourierList1.StoreID, StoreCourierList1.VendorID, sl, ctx.GetUserName())
|
||||||
break
|
// break
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
/* 美团配送的门店是否存在,调用美团配送的api(有可能接了),查询京西门店对应的美团配送门店是否存在,若不存在则要在京西这边解绑美团配送门店
|
// /* 美团配送的门店是否存在,调用美团配送的api(有可能接了),查询京西门店对应的美团配送门店是否存在,若不存在则要在京西这边解绑美团配送门店
|
||||||
怎么解绑可以在网页上门店管理那点一下看看调的什么接口,传的什么参数*/
|
// 怎么解绑可以在网页上门店管理那点一下看看调的什么接口,传的什么参数*/
|
||||||
/*获取所有门店信息*/
|
// /*获取所有门店信息*/
|
||||||
//test:
|
// //test:
|
||||||
for _, StoreCourierList1 := range StoreCourierList {
|
// for _, StoreCourierList1 := range StoreCourierList {
|
||||||
diff := false
|
// diff := false
|
||||||
StoreLists, _ := dao.GetStoreList(db, []int{StoreCourierList1.StoreID}, nil, nil, nil, "")
|
// StoreLists, _ := dao.GetStoreList(db, []int{StoreCourierList1.StoreID}, nil, nil, nil, "")
|
||||||
if StoreLists == nil {
|
// if StoreLists == nil {
|
||||||
globals.SugarLogger.Debugf("StoreID为:%s,在store表未找到", StoreCourierList1.StoreID)
|
// globals.SugarLogger.Debugf("StoreID为:%s,在store表未找到", StoreCourierList1.StoreID)
|
||||||
continue
|
// continue
|
||||||
}
|
// }
|
||||||
if StoreCourierList1.VendorID != model.VendorIDMTPS || StoreCourierList1.VendorStoreID == "" {
|
// if StoreCourierList1.VendorID != model.VendorIDMTPS || StoreCourierList1.VendorStoreID == "" {
|
||||||
continue
|
// continue
|
||||||
}
|
// }
|
||||||
if StoreCourierList1.Status == model.StoreStatusDisabled || StoreCourierList1.Status == model.StoreStatusClosed {
|
// if StoreCourierList1.Status == model.StoreStatusDisabled || StoreCourierList1.Status == model.StoreStatusClosed {
|
||||||
continue
|
// continue
|
||||||
}
|
// }
|
||||||
/*京西不为空,容错*/
|
// /*京西不为空,容错*/
|
||||||
//if {
|
// //if {
|
||||||
/*调用API获取美团的商店信息*/
|
// /*调用API获取美团的商店信息*/
|
||||||
MTPSInfo := new(mtpsapi.ShopInfo)
|
// MTPSInfo := new(mtpsapi.ShopInfo)
|
||||||
MTPSInfo, _ = api.MtpsAPI.ShopQuery(StoreCourierList1.VendorStoreID)
|
// MTPSInfo, _ = api.MtpsAPI.ShopQuery(StoreCourierList1.VendorStoreID)
|
||||||
if MTPSInfo == nil {
|
// if MTPSInfo == nil {
|
||||||
globals.SugarLogger.Debug("美团未找到该门店," + StoreLists[0].Name + strconv.Itoa(StoreCourierList1.StoreID) + " 被解绑,关联的ID为:" + StoreCourierList1.VendorStoreID)
|
// globals.SugarLogger.Debug("美团未找到该门店," + StoreLists[0].Name + strconv.Itoa(StoreCourierList1.StoreID) + " 被解绑,关联的ID为:" + StoreCourierList1.VendorStoreID)
|
||||||
diff = true
|
// diff = true
|
||||||
}
|
// }
|
||||||
if MTPSInfo != nil && MTPSInfo.ShopName == "" {
|
// if MTPSInfo != nil && MTPSInfo.ShopName == "" {
|
||||||
MTPSInfo.ShopName = StoreInfoList2[MTPSInfo.ShopID]
|
// MTPSInfo.ShopName = StoreInfoList2[MTPSInfo.ShopID]
|
||||||
}
|
// }
|
||||||
if MTPSInfo != nil && MTPSInfo.ShopLng != StoreCourierList1.Lng && MTPSInfo.ShopLat == StoreCourierList1.Lat {
|
// if MTPSInfo != nil && MTPSInfo.ShopLng != StoreCourierList1.Lng && MTPSInfo.ShopLat == StoreCourierList1.Lat {
|
||||||
/*平台上但是坐标不同,解绑*/
|
// /*平台上但是坐标不同,解绑*/
|
||||||
globals.SugarLogger.Debug("商店与美团配送上的坐标不同," + StoreLists[0].Name + strconv.Itoa(StoreCourierList1.StoreID) + " 被解绑,关联的ID为:" + StoreCourierList1.VendorStoreID)
|
// globals.SugarLogger.Debug("商店与美团配送上的坐标不同," + StoreLists[0].Name + strconv.Itoa(StoreCourierList1.StoreID) + " 被解绑,关联的ID为:" + StoreCourierList1.VendorStoreID)
|
||||||
if _, err := DeleteStoreCourierMap(ctx, db, StoreCourierList1.StoreID, StoreCourierList1.VendorID, ctx.GetUserName()); err != nil {
|
// if _, err := DeleteStoreCourierMap(ctx, db, StoreCourierList1.StoreID, StoreCourierList1.VendorID, ctx.GetUserName()); err != nil {
|
||||||
globals.SugarLogger.Debug(err.Error())
|
// globals.SugarLogger.Debug(err.Error())
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
diff = true
|
// diff = true
|
||||||
}
|
// }
|
||||||
if diff {
|
// if diff {
|
||||||
if _, err := DeleteStoreCourierMap(ctx, db, StoreCourierList1.StoreID, StoreCourierList1.VendorID, ctx.GetUserName()); err != nil {
|
// if _, err := DeleteStoreCourierMap(ctx, db, StoreCourierList1.StoreID, StoreCourierList1.VendorID, ctx.GetUserName()); err != nil {
|
||||||
globals.SugarLogger.Debug(err.Error())
|
// globals.SugarLogger.Debug(err.Error())
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
//break test
|
// //break test
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
globals.SugarLogger.Debug("StoreOpenAll skuID is Complete")
|
// globals.SugarLogger.Debug("StoreOpenAll skuID is Complete")
|
||||||
}
|
//}
|
||||||
|
|
||||||
//func StoreOpenAll(ctx *jxcontext.Context) {
|
//func StoreOpenAll(ctx *jxcontext.Context) {
|
||||||
//db := dao.GetDB()
|
//db := dao.GetDB()
|
||||||
@@ -801,62 +799,63 @@ func StoreOpenAll(ctx *jxcontext.Context) {
|
|||||||
//}
|
//}
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//func StoreOpenAll(ctx *jxcontext.Context) {
|
func StoreOpenAll(ctx *jxcontext.Context) {
|
||||||
// db := dao.GetDB()
|
db := dao.GetDB()
|
||||||
// StoreLists, err := dao.GetStoreList(db, nil, nil, []int{1}, nil, "")
|
StoreLists, err := dao.GetStoreList(db, nil, nil, []int{1}, nil, "")
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// globals.SugarLogger.Debugf("商店列表获取失败")
|
globals.SugarLogger.Debugf("商店列表获取失败")
|
||||||
// }
|
}
|
||||||
// var StoreMapLists []*model.StoreMap
|
var StoreMapLists []*model.StoreMap
|
||||||
// for _, StoreList := range StoreLists {
|
for _, StoreList := range StoreLists {
|
||||||
// if StoreMapLists, err = dao.GetStoresMapList(db, []int{0, 1, 3}, []int{StoreList.ID}, nil, 1, -1, "", ""); err != nil {
|
if StoreMapLists, err = dao.GetStoresMapList(db, []int{0, 1, 3}, []int{StoreList.ID}, nil, 1, -1, "", ""); err != nil {
|
||||||
// globals.SugarLogger.Debugf("商店列表获取失败")
|
globals.SugarLogger.Debugf("商店列表获取失败")
|
||||||
// }
|
}
|
||||||
// if len(StoreMapLists) > 0 {
|
if len(StoreMapLists) > 0 {
|
||||||
// /*将map查询的结果全部放进数组*/
|
/*将map查询的结果全部放进数组*/
|
||||||
// for _, StoreMapList := range StoreMapLists {
|
for _, StoreMapList := range StoreMapLists {
|
||||||
// /*二元运算符*/
|
/*二元运算符*/
|
||||||
// StoreMapList.SyncStatus = StoreMapList.SyncStatus | model.SyncFlagModifiedMask
|
StoreMapList.SyncStatus = StoreMapList.SyncStatus | model.SyncFlagModifiedMask
|
||||||
// StoreMapList.UpdatedAt = time.Now()
|
StoreMapList.UpdatedAt = time.Now()
|
||||||
// StoreMapList.LastOperator = ctx.GetUserName()
|
StoreMapList.LastOperator = ctx.GetUserName()
|
||||||
// dao.UpdateEntity(db, StoreMapList, "SyncStatus", "UpdatedAt", "LastOperator")
|
dao.UpdateEntity(db, StoreMapList, "SyncStatus", "UpdatedAt", "LastOperator")
|
||||||
// //}
|
//}
|
||||||
// /*同步*/
|
/*同步*/
|
||||||
// if _, err = CurVendorSync.SyncStore(ctx, db, StoreMapList.VendorID, StoreList.ID, false, ctx.GetUserName()); err != nil {
|
if _, err = CurVendorSync.SyncStore(ctx, db, StoreMapList.VendorID, StoreList.ID, false, ctx.GetUserName()); err != nil {
|
||||||
// globals.SugarLogger.Debugf("同步失败")
|
globals.SugarLogger.Debugf("同步失败")
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// if StoreMapLists, err = dao.GetStoresMapList(db, []int{9}, []int{StoreList.ID}, nil, 1, -1, "", ""); err != nil {
|
if StoreMapLists, err = dao.GetStoresMapList(db, []int{9}, []int{StoreList.ID}, nil, 1, -1, "", ""); err != nil {
|
||||||
// globals.SugarLogger.Debugf("商店列表获取失败")
|
globals.SugarLogger.Debugf("商店列表获取失败")
|
||||||
// }
|
}
|
||||||
// if len(StoreMapLists) == 0 {
|
if len(StoreMapLists) == 0 {
|
||||||
// /*遍历,绑定*/
|
/*遍历,绑定*/
|
||||||
// Map := &model.StoreMap{}
|
Map := &model.StoreMap{}
|
||||||
// Map.VendorStoreID = strconv.Itoa(StoreList.ID)
|
Map.VendorStoreID = strconv.Itoa(StoreList.ID)
|
||||||
// Map.AutoPickup = 1
|
Map.AutoPickup = 1
|
||||||
// Map.DeliveryCompetition = 1
|
Map.DeliveryCompetition = 1
|
||||||
// Map.PricePercentage = 100
|
Map.PricePercentage = 100
|
||||||
// Map.IsSync = 1
|
Map.IsSync = 1
|
||||||
// Map.PricePercentagePack = "京西100-100"
|
Map.PricePercentagePack = "京西100-100"
|
||||||
// Map.DeliveryFeeDeductionSill = 0
|
Map.DeliveryFeeDeductionSill = 0
|
||||||
// Map.DeliveryFeeDeductionFee = 0
|
Map.DeliveryFeeDeductionFee = 0
|
||||||
// Map.IsOrder = 0
|
Map.IsOrder = 0
|
||||||
// if _, err := AddStoreVendorMap(ctx, db, 9, "", StoreList.ID, Map); err != nil {
|
if _, err := AddStoreVendorMap(ctx, db, 9, "", StoreList.ID, Map); err != nil {
|
||||||
// globals.SugarLogger.Debugf("AddStoreVendorMap调用出错,StoreID是" + strconv.Itoa(StoreList.ID))
|
globals.SugarLogger.Debugf("AddStoreVendorMap调用出错,StoreID是" + strconv.Itoa(StoreList.ID))
|
||||||
// globals.SugarLogger.Debugf(err.Error())
|
globals.SugarLogger.Debugf(err.Error())
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// /*改配送范围*/
|
/*改配送范围*/
|
||||||
// //deliverrangetype 3
|
//deliverrangetype 3
|
||||||
// //deliverrange 3000
|
//deliverrange 3000
|
||||||
// StoreList.DeliveryRange = "3000"
|
StoreList.DeliveryRange = "3000"
|
||||||
// StoreList.DeliveryRangeType = 3
|
StoreList.DeliveryRangeType = 3
|
||||||
// StoreList.UpdatedAt = time.Now()
|
StoreList.UpdatedAt = time.Now()
|
||||||
// StoreList.LastOperator = ctx.GetUserName()
|
StoreList.LastOperator = ctx.GetUserName()
|
||||||
// dao.UpdateEntity(db, StoreList, "DeliveryRange", "DeliveryRangeType", "LastOperator", "UpdatedAt")
|
dao.UpdateEntity(db, StoreList, "DeliveryRange", "DeliveryRangeType", "LastOperator", "UpdatedAt")
|
||||||
// }
|
}
|
||||||
//}
|
globals.SugarLogger.Debug("StoreOpenAll skuID is Complete")
|
||||||
|
}
|
||||||
|
|
||||||
func TestDiff(ctx *jxcontext.Context, vendorIDList []int, storeIDList []int) {
|
func TestDiff(ctx *jxcontext.Context, vendorIDList []int, storeIDList []int) {
|
||||||
baseapi.SugarLogger.Debugf("CheckSkuDiffBetweenJxAndVendor start time: %v", time.Now())
|
baseapi.SugarLogger.Debugf("CheckSkuDiffBetweenJxAndVendor start time: %v", time.Now())
|
||||||
@@ -1332,9 +1331,9 @@ func WriteToExcel(task *tasksch.SeqTask, data map[int][]DiffData, depotData map[
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetJxPrice(jxSkuInfoDataMulti *dao.StoreSkuNamesInfo, storeId int, Vendorid int) (err error) {
|
func SetJxPrice(jxSkuInfoDataMulti *dao.StoreSkuNamesInfo, storeId int, vendorid int) (err error) {
|
||||||
db := dao.GetDB()
|
db := dao.GetDB()
|
||||||
storeDetail, err := dao.GetStoreDetail(dao.GetDB(), storeId, Vendorid)
|
storeDetail, err := dao.GetStoreDetail(dao.GetDB(), storeId, vendorid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
dao.Rollback(db)
|
dao.Rollback(db)
|
||||||
return err
|
return err
|
||||||
|
|||||||
Reference in New Issue
Block a user