1
This commit is contained in:
@@ -1543,11 +1543,8 @@ func (c *OrderManager) AmendMissingOrders(ctx *jxcontext.Context, vendorIDs []in
|
|||||||
task2 := tasksch.NewParallelTask("AmendMissingOrders GetOrders", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError), ctx,
|
task2 := tasksch.NewParallelTask("AmendMissingOrders GetOrders", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError), ctx,
|
||||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||||
pair := batchItemList[0].(*tOrderVendorPair)
|
pair := batchItemList[0].(*tOrderVendorPair)
|
||||||
globals.SugarLogger.Debugf("---------pair := %s", utils.Format4Output(pair, false))
|
|
||||||
if handler := partner.GetPurchaseOrderHandlerFromVendorID(pair.VendorID); handler != nil {
|
if handler := partner.GetPurchaseOrderHandlerFromVendorID(pair.VendorID); handler != nil {
|
||||||
globals.SugarLogger.Debugf("---------order := %s", utils.Format4Output(pair.VendorStoreID, false))
|
|
||||||
order, err2 := handler.GetOrder(pair.VendorOrgCode, pair.VendorOrderID, pair.VendorStoreID)
|
order, err2 := handler.GetOrder(pair.VendorOrgCode, pair.VendorOrderID, pair.VendorStoreID)
|
||||||
globals.SugarLogger.Debugf("---------order := %s", utils.Format4Output(order, false))
|
|
||||||
if err = err2; err == nil {
|
if err = err2; err == nil {
|
||||||
storeDetail, err := dao.GetStoreDetailByVendorStoreID(dao.GetDB(), order.VendorStoreID, order.VendorID, order.VendorOrgCode)
|
storeDetail, err := dao.GetStoreDetailByVendorStoreID(dao.GetDB(), order.VendorStoreID, order.VendorID, order.VendorOrgCode)
|
||||||
if err == nil && storeDetail != nil {
|
if err == nil && storeDetail != nil {
|
||||||
|
|||||||
@@ -312,14 +312,11 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo
|
|||||||
order.ConsigneeLat = jxutils.StandardCoordinate2Int(originalLat)
|
order.ConsigneeLat = jxutils.StandardCoordinate2Int(originalLat)
|
||||||
|
|
||||||
products := result["products"].([]interface{})[0].([]interface{})
|
products := result["products"].([]interface{})[0].([]interface{})
|
||||||
globals.SugarLogger.Debugf("----------------6")
|
|
||||||
for _, product2 := range products {
|
for _, product2 := range products {
|
||||||
product := product2.(map[string]interface{})
|
product := product2.(map[string]interface{})
|
||||||
skuName := product["product_name"].(string)
|
skuName := product["product_name"].(string)
|
||||||
globals.SugarLogger.Debugf("----------------6.1")
|
|
||||||
_, _, _, specUnit, _, specQuality := jxutils.SplitSkuName(skuName)
|
_, _, _, specUnit, _, specQuality := jxutils.SplitSkuName(skuName)
|
||||||
productAmount := int(utils.MustInterface2Int64(product["product_amount"]))
|
productAmount := int(utils.MustInterface2Int64(product["product_amount"]))
|
||||||
globals.SugarLogger.Debugf("----------------6.2")
|
|
||||||
sku := &model.OrderSku{
|
sku := &model.OrderSku{
|
||||||
VendorOrderID: order.VendorOrderID,
|
VendorOrderID: order.VendorOrderID,
|
||||||
VendorID: model.VendorIDEBAI,
|
VendorID: model.VendorIDEBAI,
|
||||||
@@ -333,9 +330,8 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo
|
|||||||
if shelfPosition, ok := product["shelf_position"]; ok {
|
if shelfPosition, ok := product["shelf_position"]; ok {
|
||||||
sku.LocationCode = shelfPosition.(string)
|
sku.LocationCode = shelfPosition.(string)
|
||||||
}
|
}
|
||||||
globals.SugarLogger.Debugf("----------------6.3")
|
|
||||||
if sku.SkuID == 0 {
|
if sku.SkuID == 0 {
|
||||||
if product["upc"] != nil {
|
if product["upc"] != nil && len(strings.Split(product["upc"].(string), "-")) > 1 {
|
||||||
sku.SkuID = utils.Str2Int(strings.Split(product["upc"].(string), "-")[1])
|
sku.SkuID = utils.Str2Int(strings.Split(product["upc"].(string), "-")[1])
|
||||||
} else if product["baidu_product_id"] != nil {
|
} else if product["baidu_product_id"] != nil {
|
||||||
skuBind, err := dao.GetStoreSkuByVendorSkuId(order.StoreID, model.VendorIDEBAI, product["baidu_product_id"].(string))
|
skuBind, err := dao.GetStoreSkuByVendorSkuId(order.StoreID, model.VendorIDEBAI, product["baidu_product_id"].(string))
|
||||||
@@ -344,20 +340,17 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
globals.SugarLogger.Debugf("----------------6.4")
|
|
||||||
var baiduRate int64
|
var baiduRate int64
|
||||||
sku.SalePrice, baiduRate, sku.StoreSubName = getSkuSalePrice(product)
|
sku.SalePrice, baiduRate, sku.StoreSubName = getSkuSalePrice(product)
|
||||||
order.PmSubsidyMoney += baiduRate
|
order.PmSubsidyMoney += baiduRate
|
||||||
if sku.Weight == 0 {
|
if sku.Weight == 0 {
|
||||||
sku.Weight = jxutils.FormatSkuWeight(specQuality, specUnit) // 订单信息里没有重量,只有名字里尝试找
|
sku.Weight = jxutils.FormatSkuWeight(specQuality, specUnit) // 订单信息里没有重量,只有名字里尝试找
|
||||||
}
|
}
|
||||||
globals.SugarLogger.Debugf("----------------6.5")
|
|
||||||
// if product["isGift"].(bool) {
|
// if product["isGift"].(bool) {
|
||||||
// sku.SkuType = 1
|
// sku.SkuType = 1
|
||||||
// }
|
// }
|
||||||
order.Skus = append(order.Skus, sku)
|
order.Skus = append(order.Skus, sku)
|
||||||
}
|
}
|
||||||
globals.SugarLogger.Debugf("----------------7")
|
|
||||||
giftSkus, discountMoney := getZengSkus(vendorOrderID, orderData)
|
giftSkus, discountMoney := getZengSkus(vendorOrderID, orderData)
|
||||||
order.DiscountMoney = discountMoney
|
order.DiscountMoney = discountMoney
|
||||||
order.Skus = append(order.Skus, giftSkus...)
|
order.Skus = append(order.Skus, giftSkus...)
|
||||||
@@ -366,7 +359,6 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo
|
|||||||
store, _ := dao.GetStoreDetail(dao.GetDB(), order.JxStoreID, order.VendorID, order.VendorOrgCode)
|
store, _ := dao.GetStoreDetail(dao.GetDB(), order.JxStoreID, order.VendorID, order.VendorOrgCode)
|
||||||
order.PackagePrice = store.PackageSetting
|
order.PackagePrice = store.PackageSetting
|
||||||
jxutils.RefreshOrderSkuRelated(order)
|
jxutils.RefreshOrderSkuRelated(order)
|
||||||
globals.SugarLogger.Debugf("----------------8")
|
|
||||||
return order
|
return order
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user